summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/arg_returned.ll30
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nonnull.ll12
-rw-r--r--llvm/test/Transforms/FunctionAttrs/noreturn_async.ll2
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nounwind.ll2
4 files changed, 44 insertions, 2 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
index fb7e5d9bc9e..6e57475c579 100644
--- a/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
+++ b/llvm/test/Transforms/FunctionAttrs/arg_returned.ll
@@ -796,6 +796,36 @@ r:
ret i32 %PHI2
}
+define weak_odr i32 @non_exact_0() {
+ ret i32 0
+}
+define weak_odr i32 @non_exact_1(i32 %a) {
+ ret i32 %a
+}
+define weak_odr i32 @non_exact_2(i32 returned %a) {
+ ret i32 %a
+}
+define weak_odr i32* @non_exact_3(i32* align 32 returned %a) {
+ ret i32* %a
+}
+define i32 @exact(i32* %a) {
+ %c0 = call i32 @non_exact_0()
+ %c1 = call i32 @non_exact_1(i32 1)
+ %c2 = call i32 @non_exact_2(i32 2)
+ %c3 = call i32* @non_exact_3(i32* %a)
+; We can use the information of the weak function non_exact_3 because it was
+; given to us and not derived (the alignment of the returned argument).
+; CHECK: %c4 = load i32, i32* %c3, align 32
+ %c4 = load i32, i32* %c3
+; FIXME: %c2 and %c3 should be replaced but not %c0 or %c1!
+; CHECK: %add1 = add i32 %c0, %c1
+; CHECK: %add2 = add i32 %add1, %c2
+; CHECK: %add3 = add i32 %add2, %c3
+ %add1 = add i32 %c0, %c1
+ %add2 = add i32 %add1, %c2
+ %add3 = add i32 %add2, %c4
+ ret i32 %add3
+}
attributes #0 = { noinline nounwind uwtable }
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index 7a51cb32d6a..69f0b0dd550 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -458,4 +458,16 @@ define i32* @g1() {
ret i32* %c
}
+; ATTRIBUTOR: define internal void @called_by_weak(i32* nocapture nonnull %a)
+define internal void @called_by_weak(i32* %a) {
+ ret void
+}
+
+; Check we do not annotate the function interface of this weak function.
+; ATTRIBUTOR: define weak_odr void @weak_caller(i32* nonnull %a)
+define weak_odr void @weak_caller(i32* nonnull %a) {
+ call void @called_by_weak(i32* %a)
+ ret void
+}
+
attributes #0 = { "null-pointer-is-valid"="true" }
diff --git a/llvm/test/Transforms/FunctionAttrs/noreturn_async.ll b/llvm/test/Transforms/FunctionAttrs/noreturn_async.ll
index b7e9b0f4058..57174d4d90d 100644
--- a/llvm/test/Transforms/FunctionAttrs/noreturn_async.ll
+++ b/llvm/test/Transforms/FunctionAttrs/noreturn_async.ll
@@ -1,4 +1,4 @@
-; RUN: opt -functionattrs -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 -S < %s | FileCheck %s
+; RUN: opt -functionattrs -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=4 -S < %s | FileCheck %s
;
; This file is the same as noreturn_sync.ll but with a personality which
; indicates that the exception handler *can* catch asynchronous exceptions. As
diff --git a/llvm/test/Transforms/FunctionAttrs/nounwind.ll b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
index 50a229dcb3d..495aaeaacac 100644
--- a/llvm/test/Transforms/FunctionAttrs/nounwind.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
@@ -1,5 +1,5 @@
; RUN: opt < %s -functionattrs -S | FileCheck %s
-; RUN: opt < %s -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=4 -S | FileCheck %s --check-prefix=ATTRIBUTOR
+; RUN: opt < %s -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=6 -S | FileCheck %s --check-prefix=ATTRIBUTOR
; TEST 1
; CHECK: Function Attrs: norecurse nounwind readnone
OpenPOWER on IntegriCloud