1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/CodeGen/Thumb/stack-mis-alignment.ll
Huihui Zhang 2d8dc5b133 [ARM][ConstantIslands] Fix stack mis-alignment caused by undoLRSpillRestore.
Summary:
It is not safe for ARMConstantIslands to undoLRSpillRestore. PrologEpilogInserter is
the one to ensure stack alignment, taking into consideration LR is spilled or not.

For noreturn function with StackAlignment 8 (function contains call/alloc),
undoLRSpillRestore cause stack be mis-aligned. Fixing stack alignment in
ARMConstantIslands doesn't give us much benefit, as undo LR spill/restore only
occur in large function with near branches only, also doesn't have callee-saved LR spill.

Reviewers: t.p.northover, rengolin, efriedma, apazos, samparker, ostannard

Reviewed By: ostannard

Subscribers: dmgreen, ostannard, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75288
2020-03-02 16:28:57 -08:00

19 lines
528 B
LLVM

; RUN: llc -O0 < %s | FileCheck %s
; For noreturn function with StackAlignment 8 (function contains call/alloc),
; check that lr is saved to keep the stack aligned.
; CHECK: push {lr}
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv5e-none-linux-gnueabi"
define dso_local i32 @f() noreturn nounwind {
entry:
call i32 @llvm.arm.space(i32 2048, i32 undef)
tail call i32 @exit(i32 0)
unreachable
}
declare i32 @llvm.arm.space(i32, i32)
declare dso_local i32 @exit(i32)