summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorJohannes Doerfert <jdoerfert@anl.gov>2019-10-13 02:24:02 +0000
committerJohannes Doerfert <jdoerfert@anl.gov>2019-10-13 02:24:02 +0000
commitea1e81f54b953ac6846578e074ff7bb265b030ca (patch)
tree21309c071e4f2928367a552e3cbf76b051908a83 /llvm/test/Transforms/FunctionAttrs
parent92694eba933ef4ea0b1b6377809ff266df37d61b (diff)
downloadbcm5719-llvm-ea1e81f54b953ac6846578e074ff7bb265b030ca.tar.gz
bcm5719-llvm-ea1e81f54b953ac6846578e074ff7bb265b030ca.zip
[Attributor][FIX] Avoid modifying naked/optnone functions
The check for naked/optnone was insufficient for different reasons. We now check before we initialize an abstract attribute and we do it for all abstract attributes. llvm-svn: 374694
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nonnull.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index 63b2380a7fc..7e7b1ad2143 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -545,6 +545,30 @@ define weak_odr void @weak_caller(i32* nonnull %a) {
ret void
}
+; Expect nonnull
+; ATTRIBUTOR: define internal void @control(i32* nocapture nonnull readnone align 16 dereferenceable(8) %a)
+define internal void @control(i32* dereferenceable(4) %a) {
+ call void @use_i32_ptr(i32* %a)
+ ret void
+}
+; Avoid nonnull as we do not touch naked functions
+; ATTRIBUTOR: define internal void @naked(i32* dereferenceable(4) %a)
+define internal void @naked(i32* dereferenceable(4) %a) naked {
+ call void @use_i32_ptr(i32* %a)
+ ret void
+}
+; Avoid nonnull as we do not touch optnone
+; ATTRIBUTOR: define internal void @optnone(i32* dereferenceable(4) %a)
+define internal void @optnone(i32* dereferenceable(4) %a) optnone noinline {
+ call void @use_i32_ptr(i32* %a)
+ ret void
+}
+define void @make_live(i32* nonnull dereferenceable(8) %a) {
+ call void @naked(i32* nonnull dereferenceable(8) align 16 %a)
+ call void @control(i32* nonnull dereferenceable(8) align 16 %a)
+ call void @optnone(i32* nonnull dereferenceable(8) align 16 %a)
+ ret void
+}
attributes #0 = { "null-pointer-is-valid"="true" }
attributes #1 = { nounwind willreturn}
OpenPOWER on IntegriCloud