diff options
Diffstat (limited to 'llvm/test/Transforms/ArgumentPromotion/musttail.ll')
| -rw-r--r-- | llvm/test/Transforms/ArgumentPromotion/musttail.ll | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/llvm/test/Transforms/ArgumentPromotion/musttail.ll b/llvm/test/Transforms/ArgumentPromotion/musttail.ll index aa187116869..29511d009df 100644 --- a/llvm/test/Transforms/ArgumentPromotion/musttail.ll +++ b/llvm/test/Transforms/ArgumentPromotion/musttail.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes ; RUN: opt < %s -argpromotion -S | FileCheck %s ; PR36543 @@ -5,8 +6,16 @@ %T = type { i32, i32, i32, i32 } -; CHECK-LABEL: define internal i32 @test(%T* %p) define internal i32 @test(%T* %p) { +; CHECK-LABEL: define {{[^@]+}}@test +; CHECK-SAME: (%T* [[P:%.*]]) +; CHECK-NEXT: [[A_GEP:%.*]] = getelementptr [[T:%.*]], %T* [[P]], i64 0, i32 3 +; CHECK-NEXT: [[B_GEP:%.*]] = getelementptr [[T]], %T* [[P]], i64 0, i32 2 +; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[A_GEP]] +; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[B_GEP]] +; CHECK-NEXT: [[V:%.*]] = add i32 [[A]], [[B]] +; CHECK-NEXT: ret i32 [[V]] +; %a.gep = getelementptr %T, %T* %p, i64 0, i32 3 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2 %a = load i32, i32* %a.gep @@ -15,8 +24,12 @@ define internal i32 @test(%T* %p) { ret i32 %v } -; CHECK-LABEL: define i32 @caller(%T* %p) define i32 @caller(%T* %p) { +; CHECK-LABEL: define {{[^@]+}}@caller +; CHECK-SAME: (%T* [[P:%.*]]) +; CHECK-NEXT: [[V:%.*]] = musttail call i32 @test(%T* [[P]]) +; CHECK-NEXT: ret i32 [[V]] +; %v = musttail call i32 @test(%T* %p) ret i32 %v } @@ -24,11 +37,24 @@ define i32 @caller(%T* %p) { ; Don't promote arguments of musttail caller define i32 @foo(%T* %p, i32 %v) { +; CHECK-LABEL: define {{[^@]+}}@foo +; CHECK-SAME: (%T* [[P:%.*]], i32 [[V:%.*]]) +; CHECK-NEXT: ret i32 0 +; ret i32 0 } -; CHECK-LABEL: define internal i32 @test2(%T* %p, i32 %p2) define internal i32 @test2(%T* %p, i32 %p2) { +; CHECK-LABEL: define {{[^@]+}}@test2 +; CHECK-SAME: (%T* [[P:%.*]], i32 [[P2:%.*]]) +; CHECK-NEXT: [[A_GEP:%.*]] = getelementptr [[T:%.*]], %T* [[P]], i64 0, i32 3 +; CHECK-NEXT: [[B_GEP:%.*]] = getelementptr [[T]], %T* [[P]], i64 0, i32 2 +; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[A_GEP]] +; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[B_GEP]] +; CHECK-NEXT: [[V:%.*]] = add i32 [[A]], [[B]] +; CHECK-NEXT: [[CA:%.*]] = musttail call i32 @foo(%T* undef, i32 [[V]]) +; CHECK-NEXT: ret i32 [[CA]] +; %a.gep = getelementptr %T, %T* %p, i64 0, i32 3 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2 %a = load i32, i32* %a.gep @@ -38,8 +64,12 @@ define internal i32 @test2(%T* %p, i32 %p2) { ret i32 %ca } -; CHECK-LABEL: define i32 @caller2(%T* %g) define i32 @caller2(%T* %g) { +; CHECK-LABEL: define {{[^@]+}}@caller2 +; CHECK-SAME: (%T* [[G:%.*]]) +; CHECK-NEXT: [[V:%.*]] = call i32 @test2(%T* [[G]], i32 0) +; CHECK-NEXT: ret i32 [[V]] +; %v = call i32 @test2(%T* %g, i32 0) ret i32 %v } |

