diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-06-18 16:49:33 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-06-18 16:49:33 +0000 |
| commit | b9f91667e1ca22e27ac7eb0274ea1e77f967284c (patch) | |
| tree | ccaa70dded07f23028aa6655e750cbc8df9333c4 | |
| parent | 6cf1b791dd425152f1062cca190a3523ef3280ae (diff) | |
| download | bcm5719-llvm-b9f91667e1ca22e27ac7eb0274ea1e77f967284c.tar.gz bcm5719-llvm-b9f91667e1ca22e27ac7eb0274ea1e77f967284c.zip | |
Treat the ARM inline asm {cc} constraint as a physreg (%CPSR), just like X86
does for {flags}. If we create virtual registers of the CCR class, RegAllocFast
may try to spill them, and we can't do that.
llvm-svn: 106289
| -rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/crash-O0.ll | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 2d963fa9703..5ec995f771c 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -4945,7 +4945,7 @@ ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint, } } if (StringRef("{cc}").equals_lower(Constraint)) - return std::make_pair(0U, ARM::CCRRegisterClass); + return std::make_pair(unsigned(ARM::CPSR), ARM::CCRRegisterClass); return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); } diff --git a/llvm/test/CodeGen/ARM/crash-O0.ll b/llvm/test/CodeGen/ARM/crash-O0.ll new file mode 100644 index 00000000000..4f0f39fe38a --- /dev/null +++ b/llvm/test/CodeGen/ARM/crash-O0.ll @@ -0,0 +1,12 @@ +; RUN: llc < %s -O0 -relocation-model=pic -disable-fp-elim +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64-n32" +target triple = "armv6-apple-darwin10" + +%struct0 = type { i32, i32 } + +; This function would crash RegAllocFast because it tried to spill %CPSR. +define arm_apcscc void @clobber_cc() nounwind noinline ssp { +entry: + %asmtmp = call %struct0 asm sideeffect "...", "=&r,=&r,r,Ir,r,~{cc},~{memory}"(i32* undef, i32 undef, i32 1) nounwind ; <%0> [#uses=0] + unreachable +} |

