summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp7
-rw-r--r--llvm/test/Transforms/JumpThreading/crash-assertingvh.ll19
2 files changed, 24 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 8e6020bb22e..d0266b8bf7e 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -148,11 +148,14 @@ PreservedAnalyses JumpThreadingPass::run(Function &F,
}
bool Changed =
runImpl(F, &TLI, &LVI, HasProfileData, std::move(BFI), std::move(BPI));
+
+ // FIXME: We need to invalidate LVI to avoid PR28400. Is there a better
+ // solution?
+ AM.invalidate<LazyValueAnalysis>(F);
+
if (!Changed)
return PreservedAnalyses::all();
PreservedAnalyses PA;
- // FIXME: Not preserving LVI! We need it to be invalidated so that we
- // don't run into issues like PR28400. Is there a better solution?
PA.preserve<GlobalsAA>();
return PA;
}
diff --git a/llvm/test/Transforms/JumpThreading/crash-assertingvh.ll b/llvm/test/Transforms/JumpThreading/crash-assertingvh.ll
new file mode 100644
index 00000000000..e7843199223
--- /dev/null
+++ b/llvm/test/Transforms/JumpThreading/crash-assertingvh.ll
@@ -0,0 +1,19 @@
+; RUN: opt -disable-output < %s -passes='module(function(jump-threading),globaldce)'
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare i32 @bar()
+
+define internal i32 @foo() {
+entry:
+ %call4 = call i32 @bar()
+ %cmp5 = icmp eq i32 %call4, 0
+ br i1 %cmp5, label %if.then6, label %if.end8
+
+if.then6:
+ ret i32 0
+
+if.end8:
+ ret i32 1
+}
OpenPOWER on IntegriCloud