1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Transforms/GlobalDCE/crash-assertingvh.ll
Chandler Carruth d7cc3d1b4a [PH] Replace uses of AssertingVH from members of analysis results with
a lazy-asserting PoisoningVH.

AssertVH is fundamentally incompatible with cache-invalidation of
analysis results. The invaliadtion happens after the AssertingVH has
already fired. Instead, use a PoisoningVH that will assert if the
dangling handle is ever used rather than merely be assigned or
destroyed.

This patch also removes all of the (numerous) doomed attempts to work
around this fundamental incompatibility. It is a pretty significant
simplification IMO.

The most interesting change is in the Inliner where we still do some
clearing because we don't want to rely on the coarse grained
invalidation strategy of the containing pass manager. However, I prefer
the approach that contains this logic to the cleanup phase of the
Inliner, and I think we could enhance the CGSCC analysis management
layer to make this even better in the future if desired.

The rest is straight cleanup.

I've also added a test for one of the harder cases to work around: when
a *module analysis* contains many AssertingVHes pointing at functions.

Differential Revision: https://reviews.llvm.org/D29006

llvm-svn: 292928
2017-01-24 12:55:57 +00:00

25 lines
699 B
LLVM

; Make sure that if a pass like jump threading populates a function analysis
; like LVI with asserting handles into the body of a function, those don't begin
; to assert when global DCE deletes the body of the function.
;
; RUN: opt -disable-output < %s -passes='module(function(jump-threading),globaldce)'
; RUN: opt -disable-output < %s -passes='module(rpo-functionattrs,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
}