Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit c7b61ab

Browse files
committed
Revert r351938 "[ARM] Alter the register allocation order for minsize on Thumb2"
This change caused fatal backend errors when compiling a file in libvpx for Android. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351979 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 48aefa8 commit c7b61ab

File tree

2 files changed

+4
-133
lines changed

2 files changed

+4
-133
lines changed

lib/Target/ARM/ARMRegisterInfo.td

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,13 @@ def FPINST2 : ARMReg<10, "fpinst2">;
204204
def GPR : RegisterClass<"ARM", [i32], 32, (add (sequence "R%u", 0, 12),
205205
SP, LR, PC)> {
206206
// Allocate LR as the first CSR since it is always saved anyway.
207-
// For Thumb2, using LR would force 32bit Thumb2 instructions, not the smaller
208-
// Thumb1 ones. It is a little better for codesize on average to use the
209-
// default order.
210207
// For Thumb1 mode, we don't want to allocate hi regs at all, as we don't
211208
// know how to spill them. If we make our prologue/epilogue code smarter at
212209
// some point, we can go back to using the above allocation orders for the
213210
// Thumb1 instructions that know how to use hi regs.
214211
let AltOrders = [(add LR, GPR), (trunc GPR, 8)];
215212
let AltOrderSelect = [{
216-
if (MF.getSubtarget<ARMSubtarget>().isThumb1Only())
217-
return 2;
218-
if (MF.getSubtarget<ARMSubtarget>().isThumb2() &&
219-
MF.getFunction().optForMinSize())
220-
return 0;
221-
return 1;
213+
return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
222214
}];
223215
let DiagnosticString = "operand must be a register in range [r0, r15]";
224216
}
@@ -229,12 +221,7 @@ def GPR : RegisterClass<"ARM", [i32], 32, (add (sequence "R%u", 0, 12),
229221
def GPRnopc : RegisterClass<"ARM", [i32], 32, (sub GPR, PC)> {
230222
let AltOrders = [(add LR, GPRnopc), (trunc GPRnopc, 8)];
231223
let AltOrderSelect = [{
232-
if (MF.getSubtarget<ARMSubtarget>().isThumb1Only())
233-
return 2;
234-
if (MF.getSubtarget<ARMSubtarget>().isThumb2() &&
235-
MF.getFunction().optForMinSize())
236-
return 0;
237-
return 1;
224+
return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
238225
}];
239226
let DiagnosticString = "operand must be a register in range [r0, r14]";
240227
}
@@ -245,12 +232,7 @@ def GPRnopc : RegisterClass<"ARM", [i32], 32, (sub GPR, PC)> {
245232
def GPRwithAPSR : RegisterClass<"ARM", [i32], 32, (add (sub GPR, PC), APSR_NZCV)> {
246233
let AltOrders = [(add LR, GPRnopc), (trunc GPRnopc, 8)];
247234
let AltOrderSelect = [{
248-
if (MF.getSubtarget<ARMSubtarget>().isThumb1Only())
249-
return 2;
250-
if (MF.getSubtarget<ARMSubtarget>().isThumb2() &&
251-
MF.getFunction().optForMinSize())
252-
return 0;
253-
return 1;
235+
return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
254236
}];
255237
let DiagnosticString = "operand must be a register in range [r0, r14] or apsr_nzcv";
256238
}
@@ -271,12 +253,7 @@ def GPRsp : RegisterClass<"ARM", [i32], 32, (add SP)> {
271253
def rGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, SP, PC)> {
272254
let AltOrders = [(add LR, rGPR), (trunc rGPR, 8)];
273255
let AltOrderSelect = [{
274-
if (MF.getSubtarget<ARMSubtarget>().isThumb1Only())
275-
return 2;
276-
if (MF.getSubtarget<ARMSubtarget>().isThumb2() &&
277-
MF.getFunction().optForMinSize())
278-
return 0;
279-
return 1;
256+
return 1 + MF.getSubtarget<ARMSubtarget>().isThumb1Only();
280257
}];
281258
let DiagnosticType = "rGPR";
282259
}

test/CodeGen/Thumb2/reg-order.ll

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)