summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2015-07-20 21:42:14 +0000
committerQuentin Colombet <qcolombet@apple.com>2015-07-20 21:42:14 +0000
commit71a71485f40480ee28f257dfd38a29e859679342 (patch)
tree5c1dfc91ddc1817dfb0982daafaaad9884cd5aab /llvm/test
parent48a9bdc6aa0385f0773445b9561e12456983c8da (diff)
downloadbcm5719-llvm-71a71485f40480ee28f257dfd38a29e859679342.tar.gz
bcm5719-llvm-71a71485f40480ee28f257dfd38a29e859679342.zip
[ARM] Refactor the prologue/epilogue emission to be more robust.
This is the first step toward supporting shrink-wrapping for this target. The changes could be summarized by these items: - Expand the tail-call return as part of the expand pseudo pass. - Get rid of the assumptions that the epilogue is the exit block: * Do not assume which registers are free in the epilogue. (This indirectly improve the lowering of the code for the segmented stacks, see the test cases.) * Take into account that the basic block can be empty. Related to <rdar://problem/20821730> llvm-svn: 242714
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/ARM/fold-stack-adjust.ll4
-rw-r--r--llvm/test/CodeGen/ARM/thumb1_return_sequence.ll51
-rw-r--r--llvm/test/CodeGen/Thumb/pop.ll4
-rw-r--r--llvm/test/CodeGen/Thumb/vargs.ll6
4 files changed, 35 insertions, 30 deletions
diff --git a/llvm/test/CodeGen/ARM/fold-stack-adjust.ll b/llvm/test/CodeGen/ARM/fold-stack-adjust.ll
index 1fd9bd9e47a..b62d0dfee07 100644
--- a/llvm/test/CodeGen/ARM/fold-stack-adjust.ll
+++ b/llvm/test/CodeGen/ARM/fold-stack-adjust.ll
@@ -170,9 +170,9 @@ define void @test_varsize(...) minsize {
; CHECK-T1: push {r5, r6, r7, lr}
; ...
; CHECK-T1: pop {r2, r3, r7}
-; CHECK-T1: pop {r3}
+; CHECK-T1: pop {[[POP_REG:r[0-3]]]}
; CHECK-T1: add sp, #16
-; CHECK-T1: bx r3
+; CHECK-T1: bx [[POP_REG]]
; CHECK-LABEL: test_varsize:
; CHECK: sub sp, #16
diff --git a/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll b/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll
index 9c62faeaa68..5b9c19ab5eb 100644
--- a/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll
+++ b/llvm/test/CodeGen/ARM/thumb1_return_sequence.ll
@@ -23,11 +23,9 @@ entry:
; --------
; CHECK-V4T: add sp,
; CHECK-V4T-NEXT: pop {[[SAVED]]}
-; CHECK-V4T-NEXT: mov r12, r3
-; CHECK-V4T-NEXT: pop {r3}
-; CHECK-V4T-NEXT: mov lr, r3
-; CHECK-V4T-NEXT: mov r3, r12
-; CHECK-V4T: bx lr
+; We do not have any SP update to insert so we can just optimize
+; the pop sequence.
+; CHECK-V4T-NEXT: pop {pc}
; CHECK-V5T: pop {[[SAVED]], pc}
}
@@ -53,19 +51,19 @@ entry:
; Epilogue
; --------
; CHECK-V4T: pop {[[SAVED]]}
-; CHECK-V4T-NEXT: mov r12, r3
-; CHECK-V4T-NEXT: pop {r3}
+; CHECK-V4T-NEXT: mov r12, [[POP_REG:r[0-7]]]
+; CHECK-V4T-NEXT: pop {[[POP_REG]]}
; CHECK-V4T-NEXT: add sp,
-; CHECK-V4T-NEXT: mov lr, r3
-; CHECK-V4T-NEXT: mov r3, r12
+; CHECK-V4T-NEXT: mov lr, [[POP_REG]]
+; CHECK-V4T-NEXT: mov [[POP_REG]], r12
; CHECK-V4T: bx lr
; CHECK-V5T: add sp,
; CHECK-V5T-NEXT: pop {[[SAVED]]}
-; CHECK-V5T-NEXT: mov r12, r3
-; CHECK-V5T-NEXT: pop {r3}
+; CHECK-V5T-NEXT: mov r12, [[POP_REG:r[0-7]]]
+; CHECK-V5T-NEXT: pop {[[POP_REG]]}
; CHECK-V5T-NEXT: add sp,
-; CHECK-V5T-NEXT: mov lr, r3
-; CHECK-V5T-NEXT: mov r3, r12
+; CHECK-V5T-NEXT: mov lr, [[POP_REG]]
+; CHECK-V5T-NEXT: mov [[POP_REG]], r12
; CHECK-V5T-NEXT: bx lr
}
@@ -95,8 +93,7 @@ entry:
; Epilogue
; --------
; CHECK-V4T: pop {[[SAVED]]}
-; CHECK-V4T: pop {r3}
-; CHECK-V4T: bx r3
+; CHECK-V4T: pop {pc}
; CHECK-V5T: pop {[[SAVED]], pc}
}
@@ -148,14 +145,18 @@ entry:
; --------
; CHECK-V4T: add sp,
; CHECK-V4T-NEXT: pop {[[SAVED]]}
-; CHECK-V4T-NEXT: pop {r3}
+; Only r1 to r3 are available to pop LR.
+; r0 is used for the return value.
+; CHECK-V4T-NEXT: pop {[[POP_REG:r[1-3]]]}
; CHECK-V4T-NEXT: add sp,
-; CHECK-V4T-NEXT: bx r3
+; CHECK-V4T-NEXT: bx [[POP_REG]]
; CHECK-V5T: add sp,
; CHECK-V5T-NEXT: pop {[[SAVED]]}
-; CHECK-V5T-NEXT: pop {r3}
+; Only r1 to r3 are available to pop LR.
+; r0 is used for the return value.
+; CHECK-V5T-NEXT: pop {[[POP_REG:r[1-3]]]}
; CHECK-V5T-NEXT: add sp,
-; CHECK-V5T-NEXT: bx r3
+; CHECK-V5T-NEXT: bx [[POP_REG]]
}
; CHECK-V4T-LABEL: noframe
@@ -191,13 +192,17 @@ entry:
; Epilogue
; --------
; CHECK-V4T: pop {[[SAVED]]}
-; CHECK-V4T-NEXT: pop {r3}
+; Only r1 to r3 are available to pop LR.
+; r0 is used for the return value.
+; CHECK-V4T-NEXT: pop {[[POP_REG:r[1-3]]]}
; CHECK-V4T-NEXT: add sp,
-; CHECK-V4T-NEXT: bx r3
+; CHECK-V4T-NEXT: bx [[POP_REG]]
; CHECK-V5T: pop {[[SAVED]]}
-; CHECK-V5T-NEXT: pop {r3}
+; Only r1 to r3 are available to pop LR.
+; r0 is used for the return value.
+; CHECK-V5T-NEXT: pop {[[POP_REG:r[1-3]]]}
; CHECK-V5T-NEXT: add sp,
-; CHECK-V5T-NEXT: bx r3
+; CHECK-V5T-NEXT: bx [[POP_REG]]
}
declare void @llvm.va_start(i8*) nounwind
diff --git a/llvm/test/CodeGen/Thumb/pop.ll b/llvm/test/CodeGen/Thumb/pop.ll
index 3c539c69017..851f793e5ee 100644
--- a/llvm/test/CodeGen/Thumb/pop.ll
+++ b/llvm/test/CodeGen/Thumb/pop.ll
@@ -3,9 +3,9 @@
define void @t(i8* %a, ...) nounwind {
; CHECK-LABEL: t:
-; CHECK: pop {r3}
+; CHECK: pop {[[POP_REG:r[0-3]]]}
; CHECK-NEXT: add sp, #12
-; CHECK-NEXT: bx r3
+; CHECK-NEXT: bx [[POP_REG]]
entry:
%a.addr = alloca i8, i32 4
call void @llvm.va_start(i8* %a.addr)
diff --git a/llvm/test/CodeGen/Thumb/vargs.ll b/llvm/test/CodeGen/Thumb/vargs.ll
index 1c7b631741b..45b42125e16 100644
--- a/llvm/test/CodeGen/Thumb/vargs.ll
+++ b/llvm/test/CodeGen/Thumb/vargs.ll
@@ -32,12 +32,12 @@ bb7: ; preds = %bb
call void @llvm.va_end( i8* %va.upgrd.4 )
ret void
-; The return sequence should pop the lr to r3, recover the stack space used to
+; The return sequence should pop the lr to r0-3, recover the stack space used to
; store variadic argument registers, then return via r3. Possibly there is a pop
; before this, but only if the function happened to use callee-saved registers.
-; CHECK: pop {r3}
+; CHECK: pop {[[POP_REG:r[0-3]]]}
; CHECK: add sp, #[[IMM]]
-; CHECK: bx r3
+; CHECK: bx [[POP_REG]]
}
declare void @llvm.va_start(i8*)
OpenPOWER on IntegriCloud