summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/InstCombine/InstructionCombining.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-10-05 20:44:29 +0000
committerJim Grosbach <grosbach@apple.com>2011-10-05 20:44:29 +0000
commite2999b48998508ac426a9c2d67db55a6ca4b4fde (patch)
treeccf0c511d33827a2dff4a310f917b12c6ffea914 /lib/Transforms/InstCombine/InstructionCombining.cpp
parentd2ed2d71c95462a6b14e7c7c8c82cb727ed342eb (diff)
downloadexternal_llvm-e2999b48998508ac426a9c2d67db55a6ca4b4fde.zip
external_llvm-e2999b48998508ac426a9c2d67db55a6ca4b4fde.tar.gz
external_llvm-e2999b48998508ac426a9c2d67db55a6ca4b4fde.tar.bz2
Revert 141203. InstCombine is looping on unit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index a302a46..cee27ff 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2009,17 +2009,20 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
++NumCombined;
// Should we replace the old instruction with a new one?
if (Result != I) {
+ DEBUG(errs() << "IC: Old = " << *I << '\n'
+ << " New = " << *Result << '\n');
+
if (!I->getDebugLoc().isUnknown())
Result->setDebugLoc(I->getDebugLoc());
// Everything uses the new instruction now.
I->replaceAllUsesWith(Result);
- // Move the name to the new instruction.
- Result->takeName(I);
-
- DEBUG(errs() << "IC: Old = " << *I << '\n'
- << " New = " << *Result << '\n');
+ // Push the new instruction and any users onto the worklist.
+ Worklist.Add(Result);
+ Worklist.AddUsersToWorkList(*Result);
+ // Move the name to the new instruction first.
+ Result->takeName(I);
// Insert the new instruction into the basic block...
BasicBlock *InstParent = I->getParent();
@@ -2032,10 +2035,6 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
InstParent->getInstList().insert(InsertPos, Result);
EraseInstFromFunction(*I);
-
- // Push the new instruction and any users onto the worklist.
- Worklist.Add(Result);
- Worklist.AddUsersToWorkList(*Result);
} else {
#ifndef NDEBUG
DEBUG(errs() << "IC: Mod = " << OrigI << '\n'