Fix a major regression from the bugfix for 2004-10-08-SelectSetCCFold.llx,
which prevented setcc's from being folded into branches. It appears that
conditional branchinst's CC operand is actually operand(2), not operand(0)
as we might expect. :(
llvm-svn: 16859
diff --git a/llvm/lib/Target/X86/X86ISelSimple.cpp b/llvm/lib/Target/X86/X86ISelSimple.cpp
index ff0ba75..3b77936 100644
--- a/llvm/lib/Target/X86/X86ISelSimple.cpp
+++ b/llvm/lib/Target/X86/X86ISelSimple.cpp
@@ -848,7 +848,7 @@
(getClassB(SCI->getOperand(0)->getType()) != cLong ||
SCI->getOpcode() == Instruction::SetEQ ||
SCI->getOpcode() == Instruction::SetNE) &&
- User->getOperand(0) == V)
+ (isa<BranchInst>(User) || User->getOperand(0) == V))
return SCI;
}
return 0;