[PATCH] D66730: Bug fix on function epilog optimization (ARM backend)
Oliver Stannard (Linaro) via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 02:50:32 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370728: Bug fix on function epilog optimization (ARM backend) (authored by ostannard, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66730?vs=217123&id=218418#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66730/new/
https://reviews.llvm.org/D66730
Files:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/trunk/test/CodeGen/ARM/fold-stack-adjust.ll
Index: llvm/trunk/test/CodeGen/ARM/fold-stack-adjust.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/fold-stack-adjust.ll
+++ llvm/trunk/test/CodeGen/ARM/fold-stack-adjust.ll
@@ -42,6 +42,19 @@
ret void
}
+define i32 @check_simple_ret() minsize {
+; CHECK-FNSTART-LABEL: check_simple_ret:
+; CHECK: push {r5, r6, r7, lr}
+; CHECK-NOT: sub sp,
+; ...
+; CHECK-NOT: add sp,
+; CHECK: pop {r2, r3, r7, pc}
+
+ %var = alloca i8, i32 8
+ call void @bar(i8* %var)
+ ret i32 0
+}
+
define void @check_simple_too_big() minsize {
; CHECK-FNSTART-LABEL: check_simple_too_big:
; CHECK: push {r7, lr}
Index: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -2420,7 +2420,8 @@
MachineOperand &MO = MI->getOperand(i);
RegList.push_back(MO);
- if (MO.isReg() && TRI->getEncodingValue(MO.getReg()) < FirstRegEnc)
+ if (MO.isReg() && !MO.isImplicit() &&
+ TRI->getEncodingValue(MO.getReg()) < FirstRegEnc)
FirstRegEnc = TRI->getEncodingValue(MO.getReg());
}
@@ -2430,7 +2431,7 @@
for (int CurRegEnc = FirstRegEnc - 1; CurRegEnc >= 0 && RegsNeeded;
--CurRegEnc) {
unsigned CurReg = RegClass->getRegister(CurRegEnc);
- if (IsT1PushPop && CurReg > ARM::R7)
+ if (IsT1PushPop && CurRegEnc > TRI->getEncodingValue(ARM::R7))
continue;
if (!IsPop) {
// Pushing any register is completely harmless, mark the register involved
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66730.218418.patch
Type: text/x-patch
Size: 1617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190903/c1018d87/attachment.bin>
More information about the llvm-commits
mailing list