diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2017-02-28 23:32:55 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2017-02-28 23:32:55 +0000 |
commit | 36795239f57337f56b840a254d6b69cdcf918101 (patch) | |
tree | a0253d40e96566559471ef66e68daf67433ab572 | |
parent | 33fd0bbbe8b2d5dd98964877d4f4344633e3197b (diff) | |
download | bcm5719-llvm-36795239f57337f56b840a254d6b69cdcf918101.tar.gz bcm5719-llvm-36795239f57337f56b840a254d6b69cdcf918101.zip |
[ARM] Don't generate deprecated T1 STM.
This prevents generating stm r1!, {r0, r1} on Thumb1, where value
stored for r1 is UNKONWN.
Patch by Zhaoshi Zheng.
Differential Revision: https://reviews.llvm.org/D27910
llvm-svn: 296538
-rw-r--r-- | llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/Thumb/stm-deprecated.ll | 19 |
2 files changed, 22 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp index c87f70397b7..8e51f136b32 100644 --- a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp +++ b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp @@ -609,13 +609,12 @@ MachineInstr *ARMLoadStoreOpt::CreateLoadStoreMulti( // Exception: If the base register is in the input reglist, Thumb1 LDM is // non-writeback. // It's also not possible to merge an STR of the base register in Thumb1. - if (isThumb1 && isi32Load(Opcode) && ContainsReg(Regs, Base)) { + if (isThumb1 && ContainsReg(Regs, Base)) { assert(Base != ARM::SP && "Thumb1 does not allow SP in register list"); - if (Opcode == ARM::tLDRi) { + if (Opcode == ARM::tLDRi) Writeback = false; - } else if (Opcode == ARM::tSTRi) { + else if (Opcode == ARM::tSTRi) return nullptr; - } } ARM_AM::AMSubMode Mode = ARM_AM::ia; diff --git a/llvm/test/CodeGen/Thumb/stm-deprecated.ll b/llvm/test/CodeGen/Thumb/stm-deprecated.ll new file mode 100644 index 00000000000..ffe2c0afd92 --- /dev/null +++ b/llvm/test/CodeGen/Thumb/stm-deprecated.ll @@ -0,0 +1,19 @@ +; RUN: llc -mtriple=thumbv6m-eabi -verify-machineinstrs %s -o - | FileCheck %s +; RUN: llc -mtriple=thumbv5e-linux-gnueabi -verify-machineinstrs %s -o - | FileCheck %s + +%0 = type { %0*, %0*, i32 } + +@x1 = external global %0, align 4 +@x2 = external global %0, align 4 + +; CHECK: str r0, [r1] +; CHECK-NEXT: str r1, [r1, #4] +; CHECK-NOT: stm + +define void @foo(i32 %unused, %0* %x) { + %first = getelementptr inbounds %0, %0* %x, i32 0, i32 0 + %second = getelementptr inbounds %0, %0* %x, i32 0, i32 1 + store %0* @x1, %0** %first + store %0* %x, %0** %second + unreachable +} |