diff options
author | Piotr Padlewski <piotr.padlewski@gmail.com> | 2018-05-05 10:23:27 +0000 |
---|---|---|
committer | Piotr Padlewski <piotr.padlewski@gmail.com> | 2018-05-05 10:23:27 +0000 |
commit | e9832dfdf366ddffba68164adb6855d17c9f87c1 (patch) | |
tree | f4c3f721b3903da7bb0ada7e34e27bd992edbd65 /llvm/test/Transforms/FunctionAttrs/nocapture.ll | |
parent | c2ad0968450085bb39b1750d3c43960610e15816 (diff) | |
download | bcm5719-llvm-e9832dfdf366ddffba68164adb6855d17c9f87c1.tar.gz bcm5719-llvm-e9832dfdf366ddffba68164adb6855d17c9f87c1.zip |
[CaptureTracking] Handle capturing of launder.invariant.group
Summary:
launder.invariant.group has the same rules of capturing as
bitcast, gep, etc - the original value is not captured
if the returned pointer is not captured.
With this patch, we mark 40% more functions as noalias when compiling with -fstrict-vtable-pointers;
1078 vs 1778 (39.37%)
Reviewers: sanjoy, davide, nlewycky, majnemer, mehdi_amini
Subscribers: JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D32673
llvm-svn: 331587
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/nocapture.ll')
-rw-r--r-- | llvm/test/Transforms/FunctionAttrs/nocapture.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll b/llvm/test/Transforms/FunctionAttrs/nocapture.ll index 931072e331e..dedec09c53e 100644 --- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll +++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll @@ -220,3 +220,21 @@ entry: store volatile i32 0, i32* %gep, align 4 ret void } + +; CHECK: nocaptureLaunder(i8* nocapture %p) +define void @nocaptureLaunder(i8* %p) { +entry: + %b = call i8* @llvm.launder.invariant.group.p0i8(i8* %p) + store i8 42, i8* %b + ret void +} + +@g2 = global i8* null +; CHECK: define void @captureLaunder(i8* %p) +define void @captureLaunder(i8* %p) { + %b = call i8* @llvm.launder.invariant.group.p0i8(i8* %p) + store i8* %b, i8** @g2 + ret void +} + +declare i8* @llvm.launder.invariant.group.p0i8(i8*) |