Re-commit 141203, but much more conservative.
authorJim Grosbach <grosbach@apple.com>
Wed, 5 Oct 2011 20:53:43 +0000 (20:53 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 5 Oct 2011 20:53:43 +0000 (20:53 +0000)
Just pull the instruction name, but don't change the order of anything
else. That keeps --debug happy and non-crashing, but doesn't change
how the worklist gets built.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141210 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstructionCombining.cpp

index cee27ff5913b0d2e512b07abcce48126d420faa7..c66f423a292e9ab9c0d6329fdbf4630d9cf24cdf 100644 (file)
@@ -2017,13 +2017,13 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
         // Everything uses the new instruction now.
         I->replaceAllUsesWith(Result);
 
+        // Move the name to the new instruction first.
+        Result->takeName(I);
+
         // 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();
         BasicBlock::iterator InsertPos = I;