[llvm-commits] [llvm] r124587 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll

Richard Osborne richard at xmos.com
Mon Jan 31 09:41:44 PST 2011


Author: friedgold
Date: Mon Jan 31 11:41:44 2011
New Revision: 124587

URL: http://llvm.org/viewvc/llvm-project?rev=124587&view=rev
Log:
Fix bug where ReduceLoadWidth was creating illegal ZEXTLOAD instructions.

Added:
    llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=124587&r1=124586&r2=124587&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jan 31 11:41:44 2011
@@ -4244,8 +4244,6 @@
   if (Opc == ISD::SIGN_EXTEND_INREG) {
     ExtType = ISD::SEXTLOAD;
     ExtVT = cast<VTSDNode>(N->getOperand(1))->getVT();
-    if (LegalOperations && !TLI.isLoadExtLegal(ISD::SEXTLOAD, ExtVT))
-      return SDValue();
   } else if (Opc == ISD::SRL) {
     // Another special-case: SRL is basically zero-extending a narrower value.
     ExtType = ISD::ZEXTLOAD;
@@ -4255,6 +4253,8 @@
     ExtVT = EVT::getIntegerVT(*DAG.getContext(),
                               VT.getSizeInBits() - N01->getZExtValue());
   }
+  if (LegalOperations && !TLI.isLoadExtLegal(ExtType, ExtVT))
+    return SDValue();
 
   unsigned EVTBits = ExtVT.getSizeInBits();
   

Added: llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll?rev=124587&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/2011-01-31-DAGCombineBug.ll Mon Jan 31 11:41:44 2011
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=xcore
+%struct.st = type <{ i8, i32, i8, i32, i8, i32 }>
+
+ at x = external global %struct.st, align 4
+
+define i32 @test_entry() nounwind {
+entry:
+  %0 = load i32* getelementptr inbounds (%struct.st* @x, i32 0, i32 3), align 2
+  ret i32 %0
+}





More information about the llvm-commits mailing list