Skip to content

Commit

Permalink
Work around PR28400 a bit harder.
Browse files Browse the repository at this point in the history
We were still crashing in the "no change" case because LVI was not
getting invalidated.

See the thread "Should analyses be able to hold AssertingVH to IR?
(related to PR28400)" for more discussion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274656 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chisophugis committed Jul 6, 2016
1 parent 5dab38c commit 631c7c3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Transforms/Scalar/JumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
19 changes: 19 additions & 0 deletions test/Transforms/JumpThreading/crash-assertingvh.ll
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 631c7c3

Please sign in to comment.