summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-30 06:22:51 +0000
committerChris Lattner <sabre@nondot.org>2009-08-30 06:22:51 +0000
commite5ecdb5a98bd19695799d65b0beaf066e5d2589e (patch)
tree91a984de62b9e151a333e2ad44ba3f9801b48ff1 /lib/Transforms
parentc3a3e3682b3e32a670948c6f62bef6022a57114b (diff)
downloadllvm-e5ecdb5a98bd19695799d65b0beaf066e5d2589e.tar.gz
llvm-e5ecdb5a98bd19695799d65b0beaf066e5d2589e.tar.bz2
llvm-e5ecdb5a98bd19695799d65b0beaf066e5d2589e.tar.xz
move AddUsersToWorkList to the worklist processing class, make the
argument stronger typed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index bda1c2153f..21ad255032 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -112,6 +112,16 @@ namespace {
return I;
}
+ /// AddUsersToWorkList - When an instruction is simplified, add all users of
+ /// the instruction to the work lists because they might get more simplified
+ /// now.
+ ///
+ void AddUsersToWorkList(Instruction &I) {
+ for (Value::use_iterator UI = I.use_begin(), UE = I.use_end();
+ UI != UE; ++UI)
+ Add(cast<Instruction>(*UI));
+ }
+
/// Zap - check that the worklist is empty and nuke the backing store for
/// the map if it is large.
@@ -141,16 +151,6 @@ namespace {
LLVMContext *Context;
LLVMContext *getContext() const { return Context; }
- /// AddUsersToWorkList - When an instruction is simplified, add all users of
- /// the instruction to the work lists because they might get more simplified
- /// now.
- ///
- void AddUsersToWorkList(Value &I) {
- for (Value::use_iterator UI = I.use_begin(), UE = I.use_end();
- UI != UE; ++UI)
- Worklist.Add(cast<Instruction>(*UI));
- }
-
/// AddOperandsToWorkList - When an instruction is simplified, add operands
/// to the work lists because they might get more simplified now.
///
@@ -312,7 +312,7 @@ namespace {
// modified.
//
Instruction *ReplaceInstUsesWith(Instruction &I, Value *V) {
- AddUsersToWorkList(I); // Add all modified instrs to worklist
+ Worklist.AddUsersToWorkList(I); // Add all modified instrs to worklist.
// If we are replacing the instruction with itself, this must be in a
// segment of unreachable code, so just clobber the instruction.
@@ -3239,8 +3239,8 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
// Handle the integer rem common cases
- if (Instruction *common = commonIRemTransforms(I))
- return common;
+ if (Instruction *Common = commonIRemTransforms(I))
+ return Common;
if (Value *RHSNeg = dyn_castNegVal(Op1))
if (!isa<Constant>(RHSNeg) ||
@@ -10349,7 +10349,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// Otherwise, it's a call, just insert cast right after the call instr
InsertNewInstBefore(NC, *Caller);
}
- AddUsersToWorkList(*Caller);
+ Worklist.AddUsersToWorkList(*Caller);
} else {
NV = UndefValue::get(Caller->getType());
}
@@ -13006,7 +13006,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
// Push the new instruction and any users onto the worklist.
Worklist.Add(Result);
- AddUsersToWorkList(*Result);
+ Worklist.AddUsersToWorkList(*Result);
// Move the name to the new instruction first.
Result->takeName(I);
@@ -13034,7 +13034,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
EraseInstFromFunction(*I);
} else {
Worklist.Add(I);
- AddUsersToWorkList(*I);
+ Worklist.AddUsersToWorkList(*I);
}
}
Changed = true;