summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorHideto Ueno <uenoku.tokotoko@gmail.com>2019-11-12 06:36:49 +0000
committerHideto Ueno <uenoku.tokotoko@gmail.com>2019-11-12 06:41:19 +0000
commit88b04ef8327cdd45bd1e973ec98be5d71e7b8383 (patch)
tree2a62275e4a68243c5539013f31f42becd7aaa29e /llvm/test/Transforms/FunctionAttrs
parent43ff63477256d584cf506dba0c222c28231b0ccc (diff)
downloadbcm5719-llvm-88b04ef8327cdd45bd1e973ec98be5d71e7b8383.tar.gz
bcm5719-llvm-88b04ef8327cdd45bd1e973ec98be5d71e7b8383.zip
[Attributor] Use must-be-executed-context in align deduction
Summary: This patch introduces align attribute deduction for callsite argument, function argument, function returned and floating value based on must-be-executed-context. Reviewers: jdoerfert, sstefan1 Reviewed By: jdoerfert Subscribers: hiraditya, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69797
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/align.ll7
-rw-r--r--llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll7
-rw-r--r--llvm/test/Transforms/FunctionAttrs/arg_returned.ll4
-rw-r--r--llvm/test/Transforms/FunctionAttrs/dereferenceable.ll2
-rw-r--r--llvm/test/Transforms/FunctionAttrs/internal-noalias.ll4
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll22
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nosync.ll18
-rw-r--r--llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll4
8 files changed, 38 insertions, 30 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/align.ll b/llvm/test/Transforms/FunctionAttrs/align.ll
index 84333b7d9e4..da7bd1b5cc9 100644
--- a/llvm/test/Transforms/FunctionAttrs/align.ll
+++ b/llvm/test/Transforms/FunctionAttrs/align.ll
@@ -330,5 +330,12 @@ e:
ret i32* %phi
}
+
+; ATTRIBUTOR: define i64 @test11(i32* nocapture nofree nonnull readonly align 8 dereferenceable(8) %p)
+define i64 @test11(i32* %p) {
+ %p-cast = bitcast i32* %p to i64*
+ %ret = load i64, i64* %p-cast, align 8
+ ret i64 %ret
+}
attributes #0 = { nounwind uwtable noinline }
attributes #1 = { uwtable noinline }
diff --git a/llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll b/llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll
index 28c0d6a6525..fa4d984e931 100644
--- a/llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll
@@ -244,7 +244,7 @@ declare i32 @printf(i8* nocapture, ...)
; }
;
; There should *not* be a no-capture attribute on %a
-; CHECK: define nonnull dereferenceable(8) i64* @not_captured_but_returned_0(i64* nofree nonnull returned writeonly dereferenceable(8) "no-capture-maybe-returned" %a)
+; CHECK: define nonnull align 8 dereferenceable(8) i64* @not_captured_but_returned_0(i64* nofree nonnull returned writeonly align 8 dereferenceable(8) "no-capture-maybe-returned" %a)
define i64* @not_captured_but_returned_0(i64* %a) #0 {
entry:
@@ -260,7 +260,8 @@ entry:
; }
;
; There should *not* be a no-capture attribute on %a
-; CHECK: define nonnull dereferenceable(8) i64* @not_captured_but_returned_1(i64* nofree nonnull writeonly dereferenceable(16) "no-capture-maybe-returned" %a)
+; FIXME: %a should have align 8
+; CHECK: define nonnull align 8 dereferenceable(8) i64* @not_captured_but_returned_1(i64* nofree nonnull writeonly dereferenceable(16) "no-capture-maybe-returned" %a)
define i64* @not_captured_but_returned_1(i64* %a) #0 {
entry:
%add.ptr = getelementptr inbounds i64, i64* %a, i64 1
@@ -320,7 +321,7 @@ entry:
; }
;
; There should *not* be a no-capture attribute on %a
-; CHECK: define nonnull dereferenceable(8) i64* @negative_test_not_captured_but_returned_call_1a(i64* nofree writeonly "no-capture-maybe-returned" %a)
+; CHECK: define nonnull align 8 dereferenceable(8) i64* @negative_test_not_captured_but_returned_call_1a(i64* nofree writeonly "no-capture-maybe-returned" %a)
define i64* @negative_test_not_captured_but_returned_call_1a(i64* %a) #0 {
entry:
%call = call i64* @not_captured_but_returned_1(i64* %a)
diff --git a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
index ff0475615e5..5572c0124a0 100644
--- a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
+++ b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
@@ -254,7 +254,7 @@ return: ; preds = %cond.end, %if.then3
;
; FNATTR: define i32* @rt0(i32* readonly %a)
; BOTH: Function Attrs: nofree noinline norecurse noreturn nosync nounwind readonly uwtable
-; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt0(i32* nocapture nofree nonnull readonly dereferenceable(4) %a)
+; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt0(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %a)
define i32* @rt0(i32* %a) #0 {
entry:
%v = load i32, i32* %a, align 4
@@ -272,7 +272,7 @@ entry:
;
; FNATTR: define noalias i32* @rt1(i32* nocapture readonly %a)
; BOTH: Function Attrs: nofree noinline norecurse noreturn nosync nounwind readonly uwtable
-; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt1(i32* nocapture nofree nonnull readonly dereferenceable(4) %a)
+; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt1(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %a)
define i32* @rt1(i32* %a) #0 {
entry:
%v = load i32, i32* %a, align 4
diff --git a/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll b/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll
index e1e5d46dc4c..1c285fa2883 100644
--- a/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll
+++ b/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll
@@ -189,7 +189,7 @@ if.false:
}
define i32* @f7_3() {
-; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @f7_3()
+; ATTRIBUTOR: define nonnull align 16 dereferenceable(4) i32* @f7_3()
%ptr = tail call i32* @unkown_ptr()
store i32 10, i32* %ptr, align 16
ret i32* %ptr
diff --git a/llvm/test/Transforms/FunctionAttrs/internal-noalias.ll b/llvm/test/Transforms/FunctionAttrs/internal-noalias.ll
index b97c501c373..fd6e17bc77f 100644
--- a/llvm/test/Transforms/FunctionAttrs/internal-noalias.ll
+++ b/llvm/test/Transforms/FunctionAttrs/internal-noalias.ll
@@ -8,7 +8,7 @@ entry:
ret i32 %add
}
-; CHECK: define private i32 @noalias_args(i32* nocapture nofree nonnull readonly dereferenceable(4) %A, i32* noalias nocapture nofree nonnull readonly dereferenceable(4) %B)
+; CHECK: define private i32 @noalias_args(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %A, i32* noalias nocapture nofree nonnull readonly align 4 dereferenceable(4) %B)
define private i32 @noalias_args(i32* %A, i32* %B) #0 {
entry:
@@ -23,7 +23,7 @@ entry:
; FIXME: Should be something like this.
; define internal i32 @noalias_args_argmem(i32* noalias nocapture readonly %A, i32* noalias nocapture readonly %B)
-; CHECK: define internal i32 @noalias_args_argmem(i32* nocapture nofree nonnull readonly dereferenceable(4) %A, i32* nocapture nofree nonnull readonly dereferenceable(4) %B)
+; CHECK: define internal i32 @noalias_args_argmem(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %A, i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %B)
;
define internal i32 @noalias_args_argmem(i32* %A, i32* %B) #1 {
diff --git a/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll b/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
index 75d812195e8..1c007ee11b4 100644
--- a/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
@@ -241,31 +241,31 @@ define void @f2() #0 {
}
; TEST 12 NoFree argument - positive.
-; ATTRIBUTOR: define double @test12(double* nocapture nofree nonnull readonly dereferenceable(8) %a)
+; ATTRIBUTOR: define double @test12(double* nocapture nofree nonnull readonly align 8 dereferenceable(8) %a)
define double @test12(double* nocapture readonly %a) {
entry:
- %0 = load double, double* %a, align 8
- %call = tail call double @cos(double %0) #2
- ret double %call
+ %0 = load double, double* %a, align 8
+ %call = tail call double @cos(double %0) #2
+ ret double %call
}
declare double @cos(double) nobuiltin nounwind nofree
; FIXME: %a should be nofree.
; TEST 13 NoFree argument - positive.
-; ATTRIBUTOR: define noalias i32* @test13(i64* nocapture nonnull readonly dereferenceable(8) %a)
+; ATTRIBUTOR: define noalias i32* @test13(i64* nocapture nonnull readonly align 8 dereferenceable(8) %a)
define noalias i32* @test13(i64* nocapture readonly %a) {
entry:
- %0 = load i64, i64* %a, align 8
- %call = tail call noalias i8* @malloc(i64 %0) #2
- %1 = bitcast i8* %call to i32*
- ret i32* %1
+ %0 = load i64, i64* %a, align 8
+ %call = tail call noalias i8* @malloc(i64 %0) #2
+ %1 = bitcast i8* %call to i32*
+ ret i32* %1
}
; ATTRIBUTOR: define void @test14(i8* nocapture %0, i8* nocapture nofree readnone %1)
define void @test14(i8* nocapture %0, i8* nocapture %1) {
- tail call void @free(i8* %0) #1
- ret void
+ tail call void @free(i8* %0) #1
+ ret void
}
declare noalias i8* @malloc(i64)
diff --git a/llvm/test/Transforms/FunctionAttrs/nosync.ll b/llvm/test/Transforms/FunctionAttrs/nosync.ll
index d14f471a2d9..abb40cf2669 100644
--- a/llvm/test/Transforms/FunctionAttrs/nosync.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nosync.ll
@@ -45,7 +45,7 @@ entry:
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define i32 @load_monotonic(i32* nocapture readonly %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
-; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture nofree nonnull readonly dereferenceable(4) %0)
+; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %0)
define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtable {
%2 = load atomic i32, i32* %0 monotonic, align 4
ret i32 %2
@@ -61,7 +61,7 @@ define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtabl
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
; FNATTR-NEXT: define void @store_monotonic(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
-; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0)
+; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0)
define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
store atomic i32 10, i32* %0 monotonic, align 4
ret void
@@ -78,7 +78,7 @@ define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
; FNATTR-NEXT: define i32 @load_acquire(i32* nocapture readonly %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture nofree nonnull readonly dereferenceable(4) %0)
+; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %0)
define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable {
%2 = load atomic i32, i32* %0 acquire, align 4
ret i32 %2
@@ -94,7 +94,7 @@ define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable
; FNATTR-NEXT: define void @load_release(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture nofree writeonly %0)
+; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture nofree writeonly align 4 %0)
define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
store atomic volatile i32 10, i32* %0 release, align 4
ret void
@@ -106,7 +106,7 @@ define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
; FNATTR-NEXT: define void @load_volatile_release(i32* nocapture %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture nofree writeonly %0)
+; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture nofree writeonly align 4 %0)
define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable {
store atomic volatile i32 10, i32* %0 release, align 4
ret void
@@ -122,7 +122,7 @@ define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable
; FNATTR-NEXT: define void @volatile_store(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR-NEXT: define void @volatile_store(i32* nofree %0)
+; ATTRIBUTOR-NEXT: define void @volatile_store(i32* nofree align 4 %0)
define void @volatile_store(i32* %0) norecurse nounwind uwtable {
store volatile i32 14, i32* %0, align 4
ret void
@@ -139,7 +139,7 @@ define void @volatile_store(i32* %0) norecurse nounwind uwtable {
; FNATTR-NEXT: define i32 @volatile_load(i32* %0)
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32* nofree %0)
+; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32* nofree align 4 %0)
define i32 @volatile_load(i32* %0) norecurse nounwind uwtable {
%2 = load volatile i32, i32* %0, align 4
ret i32 %2
@@ -224,7 +224,7 @@ define void @scc2(i32* %0) noinline nounwind uwtable {
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @foo1(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
; ATTRIBUTOR-NOT: nosync
-; ATTRIBUTOR: define void @foo1(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
+; ATTRIBUTOR: define void @foo1(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
define void @foo1(i32* %0, %"struct.std::atomic"* %1) {
store i32 100, i32* %0, align 4
@@ -257,7 +257,7 @@ define void @bar(i32* %0, %"struct.std::atomic"* %1) {
; FNATTR: Function Attrs: nofree norecurse nounwind
; FNATTR-NEXT: define void @foo1_singlethread(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind willreturn
-; ATTRIBUTOR: define void @foo1_singlethread(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
+; ATTRIBUTOR: define void @foo1_singlethread(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
define void @foo1_singlethread(i32* %0, %"struct.std::atomic"* %1) {
store i32 100, i32* %0, align 4
diff --git a/llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll b/llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll
index 5285b9dcd2a..72d062b7616 100644
--- a/llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll
+++ b/llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll
@@ -70,7 +70,7 @@ return: ; preds = %if.end, %if.then
}
; CHECK: Function Attrs: nofree nosync nounwind
-; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* nofree nonnull dereferenceable(4) %r0, i32* nofree returned %r1, i32* nofree %w0)
+; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* nofree nonnull align 4 dereferenceable(4) %r0, i32* nofree returned %r1, i32* nofree %w0)
define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) {
entry:
%0 = load i32, i32* %r0, align 4
@@ -121,7 +121,7 @@ return: ; preds = %if.end, %if.then
}
; CHECK: Function Attrs: nofree nosync nounwind
-; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* nofree nonnull dereferenceable(4) %r0, i32* nofree returned %w0)
+; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* nofree nonnull align 4 dereferenceable(4) %r0, i32* nofree returned %w0)
define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) {
entry:
%0 = load i32, i32* %r0, align 4
OpenPOWER on IntegriCloud