[llvm] d2dab92 - [InstSimplify] Add tests for "returned" attribute; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 7 08:59:36 PST 2020
Author: Nikita Popov
Date: 2020-03-07T17:17:21+01:00
New Revision: d2dab92f017f6d341ccfccdf41fa7f233ddd504f
URL: https://github.com/llvm/llvm-project/commit/d2dab92f017f6d341ccfccdf41fa7f233ddd504f
DIFF: https://github.com/llvm/llvm-project/commit/d2dab92f017f6d341ccfccdf41fa7f233ddd504f.diff
LOG: [InstSimplify] Add tests for "returned" attribute; NFC
Added:
Modified:
llvm/test/Transforms/InstSimplify/call.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 15c56d233e8d..c5706ec66649 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -977,3 +977,33 @@ define <2 x double> @negated_mag_arg_vec(<2 x double> %x) {
%r = call arcp <2 x double> @llvm.copysign.v2f64(<2 x double> %negx, <2 x double> %x)
ret <2 x double> %r
}
+
+declare i32 @passthru_i32(i32 returned)
+declare i8* @passthru_p8(i8* returned)
+
+define i32 @returned_const_int_arg() {
+; CHECK-LABEL: @returned_const_int_arg(
+; CHECK-NEXT: [[X:%.*]] = call i32 @passthru_i32(i32 42)
+; CHECK-NEXT: ret i32 42
+;
+ %x = call i32 @passthru_i32(i32 42)
+ ret i32 %x
+}
+
+define i8* @returned_const_ptr_arg() {
+; CHECK-LABEL: @returned_const_ptr_arg(
+; CHECK-NEXT: [[X:%.*]] = call i8* @passthru_p8(i8* null)
+; CHECK-NEXT: ret i8* [[X]]
+;
+ %x = call i8* @passthru_p8(i8* null)
+ ret i8* %x
+}
+
+define i32 @returned_var_arg(i32 %arg) {
+; CHECK-LABEL: @returned_var_arg(
+; CHECK-NEXT: [[X:%.*]] = call i32 @passthru_i32(i32 [[ARG:%.*]])
+; CHECK-NEXT: ret i32 [[X]]
+;
+ %x = call i32 @passthru_i32(i32 %arg)
+ ret i32 %x
+}
More information about the llvm-commits
mailing list