aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-06 18:42:36 +0000
committerOwen Anderson <resistor@mac.com>2009-07-06 18:42:36 +0000
commit508955156a25a9abc470a29e1760aa176d341cf9 (patch)
tree8b7b55caabc0fbb16b6025f38e84ebc4fbd79c31 /lib/Transforms/Scalar/InstructionCombining.cpp
parente034393b15bc9257314b0c7adfb778e0c504bed7 (diff)
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 59fbd396a3..46a7b4c30d 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11598,7 +11598,8 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
if (GV->isConstant() && GV->hasDefinitiveInitializer())
if (Constant *V =
- ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE))
+ ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE,
+ Context))
return ReplaceInstUsesWith(LI, V);
if (CE->getOperand(0)->isNullValue()) {
// Insert a new store to null instruction before the load to indicate
@@ -12876,7 +12877,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB,
}
// ConstantProp instruction if trivially constant.
- if (Constant *C = ConstantFoldInstruction(Inst, TD)) {
+ if (Constant *C = ConstantFoldInstruction(Inst, BB->getContext(), TD)) {
DOUT << "IC: ConstFold to: " << *C << " from: " << *Inst;
Inst->replaceAllUsesWith(C);
++NumConstProp;
@@ -12991,7 +12992,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
}
// Instruction isn't dead, see if we can constant propagate it.
- if (Constant *C = ConstantFoldInstruction(I, TD)) {
+ if (Constant *C = ConstantFoldInstruction(I, F.getContext(), TD)) {
DOUT << "IC: ConstFold to: " << *C << " from: " << *I;
// Add operands to the worklist.
@@ -13011,7 +13012,8 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
// See if we can constant fold its operands.
for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i)
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(i))
- if (Constant *NewC = ConstantFoldConstantExpression(CE, TD))
+ if (Constant *NewC = ConstantFoldConstantExpression(CE,
+ F.getContext(), TD))
if (NewC != CE) {
i->set(NewC);
Changed = true;