Disable the load/store optimization pass for Thumb-1.
authorJames Molloy <james.molloy@arm.com>
Thu, 12 Jun 2014 15:18:33 +0000 (15:18 +0000)
committerJames Molloy <james.molloy@arm.com>
Thu, 12 Jun 2014 15:18:33 +0000 (15:18 +0000)
Moritz's changes have improved codegen a lot, but further testing showed significant correctness problems. Disable by default until these have been worked out.

Patch by Moritz Roth!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210789 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMTargetMachine.cpp
test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll
test/CodeGen/Thumb/dyn-stackalloc.ll
test/CodeGen/Thumb/thumb-ldm.ll
test/CodeGen/Thumb/thumb-memcpy-ldm-stm.ll

index 6ef2ea4e103038da505a83573a0b1caa4b83a675..c1e866be6ef411880a67a9dd53c686e3daa0db55 100644 (file)
@@ -265,7 +265,8 @@ bool ARMPassConfig::addInstSelector() {
 }
 
 bool ARMPassConfig::addPreRegAlloc() {
-  if (getOptLevel() != CodeGenOpt::None)
+  // FIXME: Temporarily disabling Thumb-1 pre-RA Load/Store optimization pass
+  if (getOptLevel() != CodeGenOpt::None && !getARMSubtarget().isThumb1Only())
     addPass(createARMLoadStoreOptimizationPass(true));
   if (getOptLevel() != CodeGenOpt::None && getARMSubtarget().isCortexA9())
     addPass(createMLxExpansionPass());
@@ -280,8 +281,11 @@ bool ARMPassConfig::addPreRegAlloc() {
 
 bool ARMPassConfig::addPreSched2() {
   if (getOptLevel() != CodeGenOpt::None) {
-    addPass(createARMLoadStoreOptimizationPass());
-    printAndVerify("After ARM load / store optimizer");
+    // FIXME: Temporarily disabling Thumb-1 post-RA Load/Store optimization pass
+    if (!getARMSubtarget().isThumb1Only()) {
+      addPass(createARMLoadStoreOptimizationPass());
+      printAndVerify("After ARM load / store optimizer");
+    }
 
     if (getARMSubtarget().hasNEON())
       addPass(createExecutionDependencyFixPass(&ARM::DPRRegClass));
index 3c43383d7a2bc9750ae902f3975b7d269f8d7fe7..ae663697ebeb440a10f224bc39641458d2cd32a9 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -mtriple=thumbv6m-eabi -o - | FileCheck %s
+; XFAIL: *
 
 define void @foo(i32* %A) #0 {
 entry:
index 6bc39afe214aab4979ea40eae16fc83c835c326c..6c6de55347a4e8495e5676ce40e27427f0630d8b 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mtriple=thumb-apple-darwin -disable-cgp-branch-opts -disable-post-ra | FileCheck %s -check-prefix=CHECK -check-prefix=RA_GREEDY
-; RUN: llc < %s -mtriple=thumb-apple-darwin -disable-cgp-branch-opts -disable-post-ra -regalloc=basic | FileCheck %s -check-prefix=CHECK -check-prefix=RA_BASIC
+; RUN: llc < %s -mtriple=thumb-apple-darwin -disable-cgp-branch-opts -disable-post-ra | FileCheck %s
+; RUN: llc < %s -mtriple=thumb-apple-darwin -disable-cgp-branch-opts -disable-post-ra -regalloc=basic | FileCheck %s
 
        %struct.state = type { i32, %struct.info*, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
        %struct.info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
@@ -45,8 +45,7 @@ define void @t2(%struct.comment* %vc, i8* %tag, i8* %contents) {
 ; CHECK: sub sp, #
 ; CHECK: mov r[[R0:[0-9]+]], sp
 ; CHECK: str r{{[0-9+]}}, [r[[R0]]
-; RA_GREEDY: str r{{[0-9+]}}, [r[[R0]]
-; RA_BASIC: stm r[[R0]]!
+; CHECK: str r{{[0-9+]}}, [r[[R0]]
 ; CHECK-NOT: ldr r0, [sp
 ; CHECK: mov r[[R1:[0-9]+]], sp
 ; CHECK: subs r[[R2:[0-9]+]], r[[R1]], r{{[0-9]+}}
index dd98e6f300ea775c21f0bf1ce9569210890d63b5..95f3edc9c4c33d296514953747c137765e5b680f 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -mtriple=thumbv6m-eabi -o - | FileCheck %s
+; XFAIL: *
 
 @X = external global [0 x i32]          ; <[0 x i32]*> [#uses=5]
 
index 06cfd9bbef2b0433898538f0ccf95f42b4c1f906..dedc82bf68ce68fe82af78654f382293439dc92f 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple=thumbv6m-eabi %s -o - | FileCheck %s
+; XFAIL: *
 
 @d = external global [64 x i32]
 @s = external global [64 x i32]