summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-04-27 07:59:20 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-04-27 07:59:20 +0000
commit6008dfdb70f3a13b56a5c4ff60bd54435f92b135 (patch)
tree7a4380ac82bb0bd6c5a847817bceb6f8b48f6f72 /llvm/lib/Analysis/ConstantFolding.cpp
parenta1259778b4a2ddd6b2dc1ad9909bdcd152e426b8 (diff)
downloadbcm5719-llvm-6008dfdb70f3a13b56a5c4ff60bd54435f92b135.tar.gz
bcm5719-llvm-6008dfdb70f3a13b56a5c4ff60bd54435f92b135.zip
Revert r155682, "Use ConstantExpr::getExtractElement when constant-folding vectors"
It broke stage2 build. stage1/clang sometimes crashed. llvm-svn: 155699
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 59248c9ca0a..783c32e6669 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -788,10 +788,6 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I,
CommonValue = C;
}
- // Fold the PHI's operands.
- if (ConstantExpr *NewCE = dyn_cast<ConstantExpr>(CommonValue))
- CommonValue = ConstantFoldConstantExpression(NewCE, TD, TLI);
-
// If we reach here, all incoming values are the same constant or undef.
return CommonValue ? CommonValue : UndefValue::get(PN->getType());
}
@@ -799,18 +795,12 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I,
// Scan the operand list, checking to see if they are all constants, if so,
// hand off to ConstantFoldInstOperands.
SmallVector<Constant*, 8> Ops;
- for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i) {
- Constant *Op = dyn_cast<Constant>(*i);
- if (!Op)
+ for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i)
+ if (Constant *Op = dyn_cast<Constant>(*i))
+ Ops.push_back(Op);
+ else
return 0; // All operands not constant!
- // Fold the Instruction's operands.
- if (ConstantExpr *NewCE = dyn_cast<ConstantExpr>(Op))
- Op = ConstantFoldConstantExpression(NewCE, TD, TLI);
-
- Ops.push_back(Op);
- }
-
if (const CmpInst *CI = dyn_cast<CmpInst>(I))
return ConstantFoldCompareInstOperands(CI->getPredicate(), Ops[0], Ops[1],
TD, TLI);
OpenPOWER on IntegriCloud