diff options
| author | Eli Friedman <efriedma@quicinc.com> | 2019-03-27 18:33:30 +0000 |
|---|---|---|
| committer | Eli Friedman <efriedma@quicinc.com> | 2019-03-27 18:33:30 +0000 |
| commit | c388bfa23040e267dfe6295c2e5c243042a426d3 (patch) | |
| tree | ca7889d6eba43be3e26bd9399c6765de439cb9fb | |
| parent | 8a02aea6fc3636f2f5d725c1772a0b11721c1fbd (diff) | |
| download | bcm5719-llvm-c388bfa23040e267dfe6295c2e5c243042a426d3.tar.gz bcm5719-llvm-c388bfa23040e267dfe6295c2e5c243042a426d3.zip | |
[ARM] Don't confuse the scheduler for very large VLDMDIA etc.
ARMBaseInstrInfo::getNumLDMAddresses is making bad assumptions about the
memory operands of load and store-multiple operations. This doesn't
really fix the problem properly, but it's enough to prevent crashing,
at least.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41231 .
Differential Revision: https://reviews.llvm.org/D59834
llvm-svn: 357109
| -rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 7 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/vldmia-sched.mir | 31 |
2 files changed, 37 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index bb222edbcef..bc4547c996f 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -3435,7 +3435,12 @@ unsigned ARMBaseInstrInfo::getNumLDMAddresses(const MachineInstr &MI) const { I != E; ++I) { Size += (*I)->getSize(); } - return Size / 4; + // FIXME: The scheduler currently can't handle values larger than 16. But + // the values can actually go up to 32 for floating-point load/store + // multiple (VLDMIA etc.). Also, the way this code is reasoning about memory + // operations isn't right; we could end up with "extra" memory operands for + // various reasons, like tail merge merging two memory operations. + return std::min(Size / 4, 16U); } static unsigned getNumMicroOpsSingleIssuePlusExtras(unsigned Opc, diff --git a/llvm/test/CodeGen/ARM/vldmia-sched.mir b/llvm/test/CodeGen/ARM/vldmia-sched.mir new file mode 100644 index 00000000000..75ee9335835 --- /dev/null +++ b/llvm/test/CodeGen/ARM/vldmia-sched.mir @@ -0,0 +1,31 @@ +# RUN: llc -run-pass=post-RA-sched %s -o - | FileCheck %s +# CHECK: VLDMDIA +--- | + target triple = "thumbv7-w64-windows-gnu" + + @a = common dso_local local_unnamed_addr global [1 x float] zeroinitializer, align 4 + + define dso_local arm_aapcs_vfpcc i32 @g() local_unnamed_addr #0 { + unreachable + } + + attributes #0 = { "target-cpu"="cortex-a9" } + +... +--- +name: g +alignment: 1 +tracksRegLiveness: true +body: | + bb.0: + + BUNDLE implicit-def $r0 { + $r0 = t2MOVi16 target-flags(arm-lo16) @a, 14, $noreg + $r0 = t2MOVTi16 internal $r0, target-flags(arm-hi16) @a, 14, $noreg + } + $r1 = t2ADDri $r0, 8, 14, $noreg, $noreg + VLDMDIA killed $r1, 14, $noreg, def $d23, def $d24, def $d25, def $d26, def $d27, def $d28, def $d29, def $d30, def $d31 :: (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 2, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 4, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 6, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 8, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 10, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 12, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 14, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 16, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 18, i32 0) to <2 x float>*)`, align 4) + $r0, dead $cpsr = tADDi8 killed $r0, 80, 14, $noreg + VLDMDIA killed $r0, 14, $noreg, def $d0, def $d1, def $d2, def $d3, def $d4, def $d5, def $d6 :: (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 20, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 22, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 24, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 26, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 28, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 30, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 32, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 33, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 34, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 35, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 36, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 37, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 38, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 39, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 40, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 41, i32 0) to <2 x float>*)`, align 4), (load 8 from `<2 x float>* bitcast (float* getelementptr ([1 x float], [1 x float]* @a, i32 42, i32 0) to <2 x float>*)`, align 4) + +... |

