diff options
| author | Johannes Doerfert <jdoerfert@anl.gov> | 2019-10-10 05:33:21 +0000 |
|---|---|---|
| committer | Johannes Doerfert <jdoerfert@anl.gov> | 2019-10-10 05:33:21 +0000 |
| commit | 72adda1740ca893ba736690f3c2e1a7c513d1874 (patch) | |
| tree | d53ba4230fb300f2b6aa1715a2e350c56253b16d /llvm/test/Transforms/FunctionAttrs | |
| parent | 33c59abf5c69c16e5ee2b7f4846c9363980342db (diff) | |
| download | bcm5719-llvm-72adda1740ca893ba736690f3c2e1a7c513d1874.tar.gz bcm5719-llvm-72adda1740ca893ba736690f3c2e1a7c513d1874.zip | |
[Attributor] Handle `null` differently in capture and alias logic
Summary:
`null` in the default address space (=AS 0) cannot be captured nor can
it alias anything. We make this clear now as it can be important for
callbacks and other cases later on. In addition, this patch improves the
debug output for noalias deduction.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68624
llvm-svn: 374280
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
| -rw-r--r-- | llvm/test/Transforms/FunctionAttrs/callbacks.ll | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/FunctionAttrs/nocapture.ll | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/callbacks.ll b/llvm/test/Transforms/FunctionAttrs/callbacks.ll index 41d58a19f10..4bd491a0e3e 100644 --- a/llvm/test/Transforms/FunctionAttrs/callbacks.ll +++ b/llvm/test/Transforms/FunctionAttrs/callbacks.ll @@ -24,7 +24,7 @@ define void @t0_caller(i32* %a) { ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[B]] to i8* ; CHECK-NEXT: store i32 42, i32* [[B]], align 32 ; CHECK-NEXT: store i32* [[B]], i32** [[C]], align 64 -; CHECK-NEXT: call void (i32*, i32*, void (i32*, i32*, ...)*, ...) @t0_callback_broker(i32* null, i32* nonnull align 128 dereferenceable(4) [[PTR]], void (i32*, i32*, ...)* nonnull bitcast (void (i32*, i32*, i32*, i64, i32**)* @t0_callback_callee to void (i32*, i32*, ...)*), i32* [[A:%.*]], i64 99, i32** nonnull align 64 dereferenceable(8) [[C]]) +; CHECK-NEXT: call void (i32*, i32*, void (i32*, i32*, ...)*, ...) @t0_callback_broker(i32* noalias null, i32* nonnull align 128 dereferenceable(4) [[PTR]], void (i32*, i32*, ...)* nonnull bitcast (void (i32*, i32*, i32*, i64, i32**)* @t0_callback_callee to void (i32*, i32*, ...)*), i32* [[A:%.*]], i64 99, i32** nonnull align 64 dereferenceable(8) [[C]]) ; CHECK-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll b/llvm/test/Transforms/FunctionAttrs/nocapture.ll index d572e94aa3d..fafb4178c1b 100644 --- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll +++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll @@ -320,5 +320,14 @@ define i1 @captureDereferenceableOrNullICmp(i32* dereferenceable_or_null(4) %x) ret i1 %2 } +declare void @unknown(i8*) +define void @test_callsite() { +entry: +; We know that 'null' in AS 0 does not alias anything and cannot be captured +; CHECK: call void @unknown(i8* noalias nocapture null) + call void @unknown(i8* null) + ret void +} + declare i8* @llvm.launder.invariant.group.p0i8(i8*) declare i8* @llvm.strip.invariant.group.p0i8(i8*) |

