diff options
| author | Johannes Doerfert <johannes@jdoerfert.de> | 2019-11-01 22:35:18 -0500 |
|---|---|---|
| committer | Johannes Doerfert <johannes@jdoerfert.de> | 2019-11-02 01:23:18 -0500 |
| commit | 2d77b0cad008eee612e3845769d8b08455a2176c (patch) | |
| tree | 159c81e27ff5b597ba39b67d804f01dc3fa70df7 /llvm/test | |
| parent | 4c56086f8b458bbe8300b0cbd59baaf46ea38d7c (diff) | |
| download | bcm5719-llvm-2d77b0cad008eee612e3845769d8b08455a2176c.tar.gz bcm5719-llvm-2d77b0cad008eee612e3845769d8b08455a2176c.zip | |
[Attributor] Ignore BlockAddress users in call site traversal
BlockAddress users will not "call" the function so they do not qualify
as call sites in the first place. When we delete a function with
BlockAddress users we need to first remove the body so they are properly
discarded.
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/FunctionAttrs/liveness.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/liveness.ll b/llvm/test/Transforms/FunctionAttrs/liveness.ll index eef674b53ec..3b8705a5a50 100644 --- a/llvm/test/Transforms/FunctionAttrs/liveness.ll +++ b/llvm/test/Transforms/FunctionAttrs/liveness.ll @@ -2,6 +2,9 @@ ; RUN: opt -attributor --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s ; UTC_ARGS: --turn off +; CHECK: @dead_with_blockaddress_users.l = constant [2 x i8*] [i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 1 to i8*)] +@dead_with_blockaddress_users.l = constant [2 x i8*] [i8* blockaddress(@dead_with_blockaddress_users, %lab0), i8* blockaddress(@dead_with_blockaddress_users, %end)] + declare void @no_return_call() nofree noreturn nounwind readnone declare void @normal_call() readnone @@ -830,3 +833,25 @@ define i32 @switch_default_caller() { ret i32 %call2 } ; UTC_ARGS: --turn off + +; Allow blockaddress users +; CHECK-NOT @dead_with_blockaddress_users +define internal void @dead_with_blockaddress_users(i32* nocapture %pc) nounwind readonly { +entry: + br label %indirectgoto + +lab0: ; preds = %indirectgoto + %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] + br label %indirectgoto + +end: ; preds = %indirectgoto + ret void + +indirectgoto: ; preds = %lab0, %entry + %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2] + %pc.addr.0 = getelementptr i32, i32* %pc, i32 %indvar ; <i32*> [#uses=1] + %tmp1.pn = load i32, i32* %pc.addr.0 ; <i32> [#uses=1] + %indirect.goto.dest.in = getelementptr inbounds [2 x i8*], [2 x i8*]* @dead_with_blockaddress_users.l, i32 0, i32 %tmp1.pn ; <i8**> [#uses=1] + %indirect.goto.dest = load i8*, i8** %indirect.goto.dest.in ; <i8*> [#uses=1] + indirectbr i8* %indirect.goto.dest, [label %lab0, label %end] +} |

