[llvm] r200752 - ARM: fix fast-isel assertion failure

Tim Northover tnorthover at apple.com
Tue Feb 4 02:38:46 PST 2014


Author: tnorthover
Date: Tue Feb  4 04:38:46 2014
New Revision: 200752

URL: http://llvm.org/viewvc/llvm-project?rev=200752&view=rev
Log:
ARM: fix fast-isel assertion failure

Missing braces on if meant we inserted both ARM and Thumb load for a litpool
entry. This didn't end well.

rdar://problem/15959157

Added:
    llvm/trunk/test/CodeGen/ARM/fastisel-thumb-litpool.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=200752&r1=200751&r2=200752&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Tue Feb  4 04:38:46 2014
@@ -653,13 +653,14 @@ unsigned ARMFastISel::ARMMaterializeInt(
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(ARM::t2LDRpci), DestReg)
                     .addConstantPoolIndex(Idx));
-  else
+  else {
     // The extra immediate is for addrmode2.
     DestReg = constrainOperandRegClass(TII.get(ARM::LDRcp), DestReg, 0);
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(ARM::LDRcp), DestReg)
                     .addConstantPoolIndex(Idx)
                     .addImm(0));
+  }
 
   return DestReg;
 }

Added: llvm/trunk/test/CodeGen/ARM/fastisel-thumb-litpool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fastisel-thumb-litpool.ll?rev=200752&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fastisel-thumb-litpool.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fastisel-thumb-litpool.ll Tue Feb  4 04:38:46 2014
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=thumbv7-apple-ios -O0 -o - %s | FileCheck %s
+
+; We used to accidentally create both an ARM and a Thumb ldr here. It led to an
+; assertion failure at the time, but could go all the way through to emission,
+; hence the CHECK-NOT.
+
+define i32 @test_thumb_ldrlit() minsize {
+; CHECK: ldr r0, LCPI0_0
+; CHECK-NOT: ldr
+  ret i32 12345678
+}





More information about the llvm-commits mailing list