don't invalidate PN, rewrite of this code is in progress anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 46d40ef..7a7f407 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -223,10 +223,11 @@
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);