summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs/misc.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/misc.ll')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/misc.ll61
1 files changed, 57 insertions, 4 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/misc.ll b/llvm/test/Transforms/FunctionAttrs/misc.ll
index 96ceb8743fd..ea4a5046fd0 100644
--- a/llvm/test/Transforms/FunctionAttrs/misc.ll
+++ b/llvm/test/Transforms/FunctionAttrs/misc.ll
@@ -1,20 +1,73 @@
+; 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
+;
+; Mostly check we do not crash on these uses
-define void @external() {
+define internal void @internal(void (i8*)* %fp) {
+; CHECK-LABEL: define {{[^@]+}}@internal
+; CHECK-SAME: (void (i8*)* [[FP:%.*]])
+; CHECK-NEXT: entry:
+; 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 @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: [[TMP1:%.*]] = bitcast i32* [[A]] to i8*
+; CHECK-NEXT: call void [[FP]](i8* [[TMP1]])
+; CHECK-NEXT: ret void
+;
entry:
%a = alloca i32, align 4
%tmp = bitcast i32* %a to i8*
call void @foo(i32* nonnull %a)
-; Check we do not crash on these uses
-; CHECK: call void @callback1(void (i32*)* nonnull @foo)
+ call void %fp(i8* bitcast (void (i32*)* @foo to i8*))
call void @callback1(void (i32*)* nonnull @foo)
-; CHECK: call void @callback2(void (i8*)* nonnull bitcast (void (i32*)* @foo to void (i8*)*))
call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*))
+ call void @callback2(void (i8*)* %fp)
%tmp1 = bitcast i32* %a to i8*
+ call void %fp(i8* %tmp1)
+ ret void
+}
+
+define void @external(void (i8*)* %fp) {
+; CHECK-LABEL: define {{[^@]+}}@external
+; CHECK-SAME: (void (i8*)* [[FP:%.*]])
+; CHECK-NEXT: entry:
+; 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 @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 [[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
+;
+entry:
+ %a = alloca i32, align 4
+ %tmp = bitcast i32* %a to i8*
+ call void @foo(i32* nonnull %a)
+ call void @callback1(void (i32*)* nonnull @foo)
+ call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*))
+ call void @callback2(void (i8*)* %fp)
+ call void %fp(i8* bitcast (void (i32*)* @foo to i8*))
+ %tmp1 = bitcast i32* %a to i8*
+ call void %fp(i8* %tmp1)
+ call void @internal(void (i8*)* %fp)
ret void
}
define internal void @foo(i32* %a) {
+; CHECK-LABEL: define {{[^@]+}}@foo
+; CHECK-SAME: (i32* nocapture readnone [[A:%.*]])
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+;
entry:
ret void
}
OpenPOWER on IntegriCloud