[llvm-commits] [llvm] r127683 - in /llvm/trunk: lib/Target/ARM/ARMLoadStoreOptimizer.cpp test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll
Evan Cheng
evan.cheng at apple.com
Tue Mar 15 11:41:53 PDT 2011
Author: evancheng
Date: Tue Mar 15 13:41:52 2011
New Revision: 127683
URL: http://llvm.org/viewvc/llvm-project?rev=127683&view=rev
Log:
Do not form thumb2 ldrd / strd if the offset is by multiple of 4. rdar://9133587
Added:
llvm/trunk/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=127683&r1=127682&r2=127683&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Tue Mar 15 13:41:52 2011
@@ -1530,15 +1530,9 @@
// Then make sure the immediate offset fits.
int OffImm = getMemoryOpOffset(Op0);
if (isT2) {
- if (OffImm < 0) {
- if (OffImm < -255)
- // Can't fall back to t2LDRi8 / t2STRi8.
- return false;
- } else {
- int Limit = (1 << 8) * Scale;
- if (OffImm >= Limit || (OffImm & (Scale-1)))
- return false;
- }
+ int Limit = (1 << 8) * Scale;
+ if (OffImm >= Limit || (OffImm <= -Limit) || (OffImm & (Scale-1)))
+ return false;
Offset = OffImm;
} else {
ARM_AM::AddrOpc AddSub = ARM_AM::add;
Added: llvm/trunk/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll?rev=127683&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/2011-03-15-LdStMultipleBug.ll Tue Mar 15 13:41:52 2011
@@ -0,0 +1,55 @@
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8 | FileCheck %s
+
+; Do not form Thumb2 ldrd / strd if the offset is not multiple of 4.
+; rdar://9133587
+
+%struct.Outer = type { i32, [2 x %"struct.Outer::Inner"] }
+%"struct.Outer::Inner" = type { i32, i32, i8, i8 }
+
+ at oStruct = external global %struct.Outer, align 4
+
+define void @main() nounwind {
+; CHECK: main:
+; CHECK-NOT: ldrd
+; CHECK: mul
+for.body.lr.ph:
+ br label %for.body
+
+for.body: ; preds = %_Z14printIsNotZeroi.exit17.for.body_crit_edge, %for.body.lr.ph
+ %tmp3 = phi i1 [ false, %for.body.lr.ph ], [ %phitmp27, %_Z14printIsNotZeroi.exit17.for.body_crit_edge ]
+ %i.022 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %_Z14printIsNotZeroi.exit17.for.body_crit_edge ]
+ %x = getelementptr %struct.Outer* @oStruct, i32 0, i32 1, i32 %i.022, i32 0
+ %y = getelementptr %struct.Outer* @oStruct, i32 0, i32 1, i32 %i.022, i32 1
+ %inc = add i32 %i.022, 1
+ br i1 %tmp3, label %_Z14printIsNotZeroi.exit, label %if.then.i
+
+if.then.i: ; preds = %for.body
+ unreachable
+
+_Z14printIsNotZeroi.exit: ; preds = %for.body
+ %tmp8 = load i32* %x, align 4, !tbaa !0
+ %tmp11 = load i32* %y, align 4, !tbaa !0
+ %mul = mul nsw i32 %tmp11, %tmp8
+ %tobool.i14 = icmp eq i32 %mul, 0
+ br i1 %tobool.i14, label %_Z14printIsNotZeroi.exit17, label %if.then.i16
+
+if.then.i16: ; preds = %_Z14printIsNotZeroi.exit
+ unreachable
+
+_Z14printIsNotZeroi.exit17: ; preds = %_Z14printIsNotZeroi.exit
+ br i1 undef, label %_Z14printIsNotZeroi.exit17.for.body_crit_edge, label %for.end
+
+_Z14printIsNotZeroi.exit17.for.body_crit_edge: ; preds = %_Z14printIsNotZeroi.exit17
+ %b.phi.trans.insert = getelementptr %struct.Outer* @oStruct, i32 0, i32 1, i32 %inc, i32 3
+ %tmp3.pre = load i8* %b.phi.trans.insert, align 1, !tbaa !3
+ %phitmp27 = icmp eq i8 undef, 0
+ br label %for.body
+
+for.end: ; preds = %_Z14printIsNotZeroi.exit17
+ ret void
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+!3 = metadata !{metadata !"bool", metadata !1}
More information about the llvm-commits
mailing list