diff options
author | Quentin Colombet <qcolombet@apple.com> | 2015-07-20 21:42:14 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2015-07-20 21:42:14 +0000 |
commit | b2dab382ce01d602a757906160fccd9129c768f7 (patch) | |
tree | 4a6ab1837fec12ebca41e844e280be11ccf3821c /test/CodeGen/ARM/thumb1_return_sequence.ll | |
parent | c9f86c12604a377cf27a5627c11ced288c31cf1e (diff) |
[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>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/thumb1_return_sequence.ll')
-rw-r--r-- | test/CodeGen/ARM/thumb1_return_sequence.ll | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/test/CodeGen/ARM/thumb1_return_sequence.ll b/test/CodeGen/ARM/thumb1_return_sequence.ll index 9c62faeaa68..5b9c19ab5eb 100644 --- a/test/CodeGen/ARM/thumb1_return_sequence.ll +++ b/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 |