summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs/misc.ll
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-10-31 20:15:02 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2019-11-02 00:28:24 -0500
commitc36e2ebf9ff5fa869bd5717616e71a0d406d0306 (patch)
tree08e4c56068a153ba8a11f1ebc098abc53b517418 /llvm/test/Transforms/FunctionAttrs/misc.ll
parent0437bfcc8338ec79f1d209daf975b9555e51e4b1 (diff)
downloadbcm5719-llvm-c36e2ebf9ff5fa869bd5717616e71a0d406d0306.tar.gz
bcm5719-llvm-c36e2ebf9ff5fa869bd5717616e71a0d406d0306.zip
[Attributor][NFCI] Avoid unnecessary work except for testing
Trying to deduce information for declarations and calls sites of declarations is not useful in practice but only for testing. Add a flag that disables this by default but also enable it in the tests. The misc.ll test will verify the flag "works" as expected.
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/misc.ll')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/misc.ll51
1 files changed, 40 insertions, 11 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/misc.ll b/llvm/test/Transforms/FunctionAttrs/misc.ll
index ea4a5046fd0..4216c8775dd 100644
--- a/llvm/test/Transforms/FunctionAttrs/misc.ll
+++ b/llvm/test/Transforms/FunctionAttrs/misc.ll
@@ -1,6 +1,6 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -attributor -attributor-disable=false < %s | FileCheck %s
-; RUN: opt -S -aa-pipeline='basic-aa' -passes=attributor -attributor-disable=false < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
+; RUN: opt -S -attributor -attributor-disable=false < %s | FileCheck %s --check-prefixes=ALL,CHECK
+; RUN: opt -S -aa-pipeline='basic-aa' -passes=attributor -attributor-disable=false -attributor-annotate-decl-cs < %s | FileCheck %s --check-prefixes=ALL,DECL_CS
;
; Mostly check we do not crash on these uses
@@ -11,14 +11,28 @@ define internal void @internal(void (i8*)* %fp) {
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
; CHECK-NEXT: [[TMP:%.*]] = bitcast i32* [[A]] to i8*
; CHECK-NEXT: call void @foo(i32* nocapture nonnull align 4 dereferenceable(4) undef)
-; CHECK-NEXT: call void [[FP:%.*]](i8* bitcast (void (i32*)* @foo to i8*))
+; CHECK-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*))
; CHECK-NEXT: call void @callback1(void (i32*)* nonnull @foo)
-; CHECK-NEXT: call void @callback2(void (i8*)* nonnull bitcast (void (i32*)* @foo to void (i8*)*))
+; CHECK-NEXT: call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*))
; CHECK-NEXT: call void @callback2(void (i8*)* [[FP]])
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8*
; CHECK-NEXT: call void [[FP]](i8* [[TMP1]])
; CHECK-NEXT: ret void
;
+; DECL_CS-LABEL: define {{[^@]+}}@internal
+; DECL_CS-SAME: (void (i8*)* [[FP:%.*]])
+; DECL_CS-NEXT: entry:
+; DECL_CS-NEXT: [[A:%.*]] = alloca i32, align 4
+; DECL_CS-NEXT: [[TMP:%.*]] = bitcast i32* [[A]] to i8*
+; DECL_CS-NEXT: call void @foo(i32* nocapture nonnull align 4 dereferenceable(4) undef)
+; DECL_CS-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*))
+; DECL_CS-NEXT: call void @callback1(void (i32*)* nonnull @foo)
+; DECL_CS-NEXT: call void @callback2(void (i8*)* nonnull bitcast (void (i32*)* @foo to void (i8*)*))
+; DECL_CS-NEXT: call void @callback2(void (i8*)* [[FP]])
+; DECL_CS-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8*
+; DECL_CS-NEXT: call void [[FP]](i8* [[TMP1]])
+; DECL_CS-NEXT: ret void
+;
entry:
%a = alloca i32, align 4
%tmp = bitcast i32* %a to i8*
@@ -40,14 +54,29 @@ define void @external(void (i8*)* %fp) {
; CHECK-NEXT: [[TMP:%.*]] = bitcast i32* [[A]] to i8*
; CHECK-NEXT: call void @foo(i32* nocapture nonnull align 4 dereferenceable(4) undef)
; CHECK-NEXT: call void @callback1(void (i32*)* nonnull @foo)
-; CHECK-NEXT: call void @callback2(void (i8*)* nonnull bitcast (void (i32*)* @foo to void (i8*)*))
-; CHECK-NEXT: call void @callback2(void (i8*)* [[FP:%.*]])
+; CHECK-NEXT: call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*))
+; CHECK-NEXT: call void @callback2(void (i8*)* [[FP]])
; CHECK-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*))
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8*
; CHECK-NEXT: call void [[FP]](i8* [[TMP1]])
; CHECK-NEXT: call void @internal(void (i8*)* [[FP]])
; CHECK-NEXT: ret void
;
+; DECL_CS-LABEL: define {{[^@]+}}@external
+; DECL_CS-SAME: (void (i8*)* [[FP:%.*]])
+; DECL_CS-NEXT: entry:
+; DECL_CS-NEXT: [[A:%.*]] = alloca i32, align 4
+; DECL_CS-NEXT: [[TMP:%.*]] = bitcast i32* [[A]] to i8*
+; DECL_CS-NEXT: call void @foo(i32* nocapture nonnull align 4 dereferenceable(4) undef)
+; DECL_CS-NEXT: call void @callback1(void (i32*)* nonnull @foo)
+; DECL_CS-NEXT: call void @callback2(void (i8*)* nonnull bitcast (void (i32*)* @foo to void (i8*)*))
+; DECL_CS-NEXT: call void @callback2(void (i8*)* [[FP]])
+; DECL_CS-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*))
+; DECL_CS-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8*
+; DECL_CS-NEXT: call void [[FP]](i8* [[TMP1]])
+; DECL_CS-NEXT: call void @internal(void (i8*)* [[FP]])
+; DECL_CS-NEXT: ret void
+;
entry:
%a = alloca i32, align 4
%tmp = bitcast i32* %a to i8*
@@ -63,10 +92,10 @@ entry:
}
define internal void @foo(i32* %a) {
-; CHECK-LABEL: define {{[^@]+}}@foo
-; CHECK-SAME: (i32* nocapture readnone [[A:%.*]])
-; CHECK-NEXT: entry:
-; CHECK-NEXT: ret void
+; ALL-LABEL: define {{[^@]+}}@foo
+; ALL-SAME: (i32* nocapture readnone [[A:%.*]])
+; ALL-NEXT: entry:
+; ALL-NEXT: ret void
;
entry:
ret void
OpenPOWER on IntegriCloud