diff options
author | Chris Lattner <sabre@nondot.org> | 2006-11-01 04:55:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-11-01 04:55:47 +0000 |
commit | a90a24c623822c4612f054d6e90091ca02fdde5f (patch) | |
tree | a07d0c2e64766bc5f584ddd1497ccfe33c34f52f /lib/Transforms | |
parent | 7da52b295b5120eb74a70a589d059a426b06523e (diff) | |
download | external_llvm-a90a24c623822c4612f054d6e90091ca02fdde5f.zip external_llvm-a90a24c623822c4612f054d6e90091ca02fdde5f.tar.gz external_llvm-a90a24c623822c4612f054d6e90091ca02fdde5f.tar.bz2 |
Fix a bug in the previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 8f998fb..250b760 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -6787,13 +6787,16 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0)); assert(isa<BinaryOperator>(FirstInst) || isa<ShiftInst>(FirstInst)); unsigned Opc = FirstInst->getOpcode(); + const Type *LHSType = FirstInst->getOperand(0)->getType(); // Scan to see if all operands are the same opcode, all have one use, and all // kill their operands (i.e. the operands have one use). - unsigned NumValues = PN.getNumIncomingValues(); - for (unsigned i = 0; i != NumValues; ++i) { + for (unsigned i = 0; i != PN.getNumIncomingValues(); ++i) { Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i)); - if (!I || I->getOpcode() != Opc || !I->hasOneUse()) + if (!I || I->getOpcode() != Opc || !I->hasOneUse() || + // Verify type of the LHS matches so we don't fold setcc's of different + // types. + I->getOperand(0)->getType() != LHSType) return 0; } |