aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index 95d02efd78..c8fb6ae595 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -2841,7 +2841,8 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
if (SimpleV) {
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
++UI)
- Worklist.push_back(cast<Instruction>(*UI));
+ if (*UI != I)
+ Worklist.push_back(cast<Instruction>(*UI));
// Replace the instruction with its simplified value.
I->replaceAllUsesWith(SimpleV);
@@ -2869,7 +2870,8 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
// uses of To on the recursive step in most cases.
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
++UI)
- Worklist.push_back(cast<Instruction>(*UI));
+ if (*UI != I)
+ Worklist.push_back(cast<Instruction>(*UI));
// Replace the instruction with its simplified value.
I->replaceAllUsesWith(SimpleV);