[llvm-commits] [llvm] r62258 - in /llvm/trunk: lib/Target/XCore/XCoreISelDAGToDAG.cpp test/CodeGen/XCore/2009-01-08-Crash.ll
Richard Osborne
richard at xmos.com
Thu Jan 15 03:32:42 PST 2009
Author: friedgold
Date: Thu Jan 15 05:32:30 2009
New Revision: 62258
URL: http://llvm.org/viewvc/llvm-project?rev=62258&view=rev
Log:
Don't fold address calculations which use negative offsets into
the ADDRspii addressing mode.
Added:
llvm/trunk/test/CodeGen/XCore/2009-01-08-Crash.ll
Modified:
llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp?rev=62258&r1=62257&r2=62258&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp Thu Jan 15 05:32:30 2009
@@ -92,8 +92,8 @@
ConstantSDNode *CN = 0;
if ((FIN = dyn_cast<FrameIndexSDNode>(Addr.getOperand(0)))
&& (CN = dyn_cast<ConstantSDNode>(Addr.getOperand(1)))
- && (CN->getSExtValue() % 4 == 0)) {
- // Constant word offset from frame pointer
+ && (CN->getSExtValue() % 4 == 0 && CN->getSExtValue() >= 0)) {
+ // Constant positive word offset from frame index
Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32);
Offset = CurDAG->getTargetConstant(CN->getSExtValue(), MVT::i32);
return true;
Added: llvm/trunk/test/CodeGen/XCore/2009-01-08-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2009-01-08-Crash.ll?rev=62258&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/2009-01-08-Crash.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/2009-01-08-Crash.ll Thu Jan 15 05:32:30 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+;; This caused a compilation failure since the
+;; address arithmetic was folded into the LDWSP instruction,
+;; resulting in a negative offset which eliminateFrameIndex was
+;; unable to eliminate.
+define i32 @test(i32 %bar) nounwind readnone {
+entry:
+ %bar_addr = alloca i32
+ %0 = getelementptr i32* %bar_addr, i32 -1
+ %1 = load i32* %0, align 4
+ ret i32 %1
+}
More information about the llvm-commits
mailing list