Fix: Regression/CodeGen/PowerPC/2005-01-14-SetSelectCrash.ll
authorChris Lattner <sabre@nondot.org>
Fri, 14 Jan 2005 19:31:00 +0000 (19:31 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Jan 2005 19:31:00 +0000 (19:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19555 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPC32ISelSimple.cpp

index 13f68ba89499ebc74434cf4bfde7a4b03e9ae023..bad0fb1b408cc47b4815f72d8ab1ae8d7d238293 100644 (file)
@@ -959,7 +959,8 @@ static SetCondInst *canFoldSetCCIntoBranchOrSelect(Value *V) {
   if (SetCondInst *SCI = dyn_cast<SetCondInst>(V))
     if (SCI->hasOneUse()) {
       Instruction *User = cast<Instruction>(SCI->use_back());
-      if ((isa<BranchInst>(User) || isa<SelectInst>(User)) &&
+      if ((isa<BranchInst>(User) ||
+           (isa<SelectInst>(User) && User->getOperand(0) == V)) &&
           SCI->getParent() == User->getParent())
         return SCI;
     }