Doh. Incorrectly inverted condition. Also add a isOnlyUse check to match tablegen.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 16 Aug 2006 23:59:00 +0000 (23:59 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 16 Aug 2006 23:59:00 +0000 (23:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29741 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelDAGToDAG.cpp

index 176314a080850531c002b5f8ead0ea068670d0fd..442fa8d4cf06a0558a3bcfd7a35b65f0edae12e4 100644 (file)
@@ -610,7 +610,8 @@ bool X86DAGToDAGISel::TryFoldLoad(SDOperand P, SDOperand N,
                                   SDOperand &Index, SDOperand &Disp) {
   if (N.getOpcode() == ISD::LOAD &&
       N.hasOneUse() &&
-      !CanBeFoldedBy(N.Val, P.Val))
+      P.Val->isOnlyUse(N.Val) &&
+      CanBeFoldedBy(N.Val, P.Val))
     return SelectAddr(N.getOperand(1), Base, Scale, Index, Disp);
   return false;
 }