diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp index 13f68ba8949..bad0fb1b408 100644 --- a/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp @@ -959,7 +959,8 @@ static SetCondInst *canFoldSetCCIntoBranchOrSelect(Value *V) { if (SetCondInst *SCI = dyn_cast(V)) if (SCI->hasOneUse()) { Instruction *User = cast(SCI->use_back()); - if ((isa(User) || isa(User)) && + if ((isa(User) || + (isa(User) && User->getOperand(0) == V)) && SCI->getParent() == User->getParent()) return SCI; }