forked from OSchip/llvm-project
Fix a TargetLowering optimization so that it doesn't duplicate
loads when an input node has multiple uses. llvm-svn: 68398
This commit is contained in:
parent
751e7e3833
commit
8bff8a1e87
|
@ -1464,6 +1464,7 @@ TargetLowering::SimplifySetCC(MVT VT, SDValue N0, SDValue N1,
|
|||
// in the same partial word, see if we can shorten the load.
|
||||
if (DCI.isBeforeLegalize() &&
|
||||
N0.getOpcode() == ISD::AND && C1 == 0 &&
|
||||
N0.getNode()->hasOneUse() &&
|
||||
isa<LoadSDNode>(N0.getOperand(0)) &&
|
||||
N0.getOperand(0).getNode()->hasOneUse() &&
|
||||
isa<ConstantSDNode>(N0.getOperand(1))) {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
; RUN: llvm-as < %s | llc -march=x86 | grep {(%} | count 1
|
||||
|
||||
; Don't duplicate the load.
|
||||
|
||||
define fastcc i32 @foo(i32* %p) nounwind {
|
||||
%t0 = load i32* %p
|
||||
%t2 = and i32 %t0, 10
|
||||
%t3 = icmp ne i32 %t2, 0
|
||||
br i1 %t3, label %bb63, label %bb76
|
||||
|
||||
bb63:
|
||||
ret i32 %t2
|
||||
|
||||
bb76:
|
||||
ret i32 0
|
||||
}
|
Loading…
Reference in New Issue