diff options
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index 46d40ef5d1..7a7f407b96 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -223,10 +223,11 @@ static void RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred, U = PNV; // See if we can simplify it. - if (Value *V = SimplifyInstruction(User, TD)) { - User->replaceAllUsesWith(V); - User->eraseFromParent(); - } + if (User != PN) + if (Value *V = SimplifyInstruction(User, TD)) { + User->replaceAllUsesWith(V); + User->eraseFromParent(); + } } PN->replaceAllUsesWith(PNV); |