Fix: Regression/CodeGen/PowerPC/2005-01-14-SetSelectCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19555 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 13f68ba..bad0fb1 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -959,7 +959,8 @@
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;
}