Fix bug in DAGCombiner for ARM that was trying to do a ShiftCombine on illegal types...
authorTanya Lattner <tonic@nondot.org>
Thu, 18 Nov 2010 22:06:46 +0000 (22:06 +0000)
committerTanya Lattner <tonic@nondot.org>
Thu, 18 Nov 2010 22:06:46 +0000 (22:06 +0000)
Added test case.

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

lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/2010-11-17-DAGCombineShiftBug.ll [new file with mode: 0644]

index 299009b6bde159dc6f4784617d8dc71388a42ed1..7e3f98acd9b72db9e0f95f5e5d7f9c13f75c557e 100644 (file)
@@ -4985,7 +4985,8 @@ static SDValue PerformShiftCombine(SDNode *N, SelectionDAG &DAG,
   EVT VT = N->getValueType(0);
 
   // Nothing to be done for scalar shifts.
-  if (! VT.isVector())
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  if (!VT.isVector() || !TLI.isTypeLegal(VT))
     return SDValue();
 
   assert(ST->hasNEON() && "unexpected vector shift");
diff --git a/test/CodeGen/ARM/2010-11-17-DAGCombineShiftBug.ll b/test/CodeGen/ARM/2010-11-17-DAGCombineShiftBug.ll
new file mode 100644 (file)
index 0000000..b9cf352
--- /dev/null
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=arm -mattr=+neon
+define void @lshrIllegalType(<8 x i32>* %A) nounwind {
+       %tmp1 = load <8 x i32>* %A
+       %tmp2 = lshr <8 x i32> %tmp1, < i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
+       store <8 x i32> %tmp2, <8 x i32>* %A
+       ret void
+}
+