summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-03-31 21:35:30 +0000
committerCraig Topper <craig.topper@gmail.com>2017-03-31 21:35:30 +0000
commite625d742714f4f5a866685575702f2a1273a8494 (patch)
tree12bb75cc98cb3cfb147f5b96fc8e92a42cbaa77f /llvm/lib
parent16d458ea0de910f0be5b90bd76c5a2458bf9f48d (diff)
downloadbcm5719-llvm-e625d742714f4f5a866685575702f2a1273a8494.tar.gz
bcm5719-llvm-e625d742714f4f5a866685575702f2a1273a8494.zip
[InstCombine] When adding an Instruction and its Users to the worklist at the same time, make sure we put the Users in first. Then put in the instruction.
This way we ensure we immediately revisit the instruction and do any additional optimizations before visiting the users. Otherwise we might visit the users, then the instruction, then users again, then instruction again. llvm-svn: 299267
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 5b5c99aca00..94e7a7f2ade 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2935,8 +2935,8 @@ bool InstCombiner::run() {
Result->takeName(I);
// Push the new instruction and any users onto the worklist.
- Worklist.Add(Result);
Worklist.AddUsersToWorkList(*Result);
+ Worklist.Add(Result);
// Insert the new instruction into the basic block...
BasicBlock *InstParent = I->getParent();
@@ -2959,8 +2959,8 @@ bool InstCombiner::run() {
if (isInstructionTriviallyDead(I, &TLI)) {
eraseInstFromFunction(*I);
} else {
- Worklist.Add(I);
Worklist.AddUsersToWorkList(*I);
+ Worklist.Add(I);
}
}
MadeIRChange = true;
OpenPOWER on IntegriCloud