]> granicus.if.org Git - llvm/commitdiff
[SelectionDAG] Remove exit-on-error flag from test (PR27765)
authorDiana Picus <diana.picus@linaro.org>
Tue, 14 Jun 2016 07:30:20 +0000 (07:30 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 14 Jun 2016 07:30:20 +0000 (07:30 +0000)
The exit-on-error flag in the ARM test is necessary in order to avoid an
unreachable in the DAGTypeLegalizer, when trying to expand a physical register.
We can also avoid this situation by introducing a bitcast early on, where the
invalid scalar-to-vector conversion is detected.

We also add a test for PowerPC, which goes through a similar code path in the
SelectionDAGBuilder.

Fixes PR27765.

Differential Revision: http://reviews.llvm.org/D21061

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

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/CodeGen/ARM/2012-09-25-InlineAsmScalarToVectorConv2.ll
test/CodeGen/PowerPC/inline-asm-scalar-to-vector-error.ll [new file with mode: 0644]

index 68952fe4f50fb5a675aa8ba73e0823583e5d9c3a..a4d05075ef7e4cc950f5949b6d453517016f61e4 100644 (file)
@@ -445,9 +445,11 @@ static void getCopyToParts(SelectionDAG &DAG, const SDLoc &DL, SDValue Val,
          "Failed to tile the value with PartVT!");
 
   if (NumParts == 1) {
-    if (PartEVT != ValueVT)
+    if (PartEVT != ValueVT) {
       diagnosePossiblyInvalidConstraint(*DAG.getContext(), V,
                                         "scalar-to-vector conversion failed");
+      Val = DAG.getNode(ISD::BITCAST, DL, PartVT, Val);
+    }
 
     Parts[0] = Val;
     return;
index 170c09fc141b33427e09ef2f5b63056f2e151715..a928543d7cf2f99205224bf71252bd59a9add47f 100644 (file)
@@ -1,10 +1,11 @@
-; RUN: not llc -mtriple=arm-eabi -mcpu=cortex-a8 -exit-on-error %s -o - 2>&1 | FileCheck %s
+; RUN: not llc -mtriple=arm-eabi -mcpu=cortex-a8 %s -o - 2>&1 | FileCheck %s
 
 ; Check for error message:
 ; CHECK: scalar-to-vector conversion failed, possible invalid constraint for vector type
+; CHECK: scalar-to-vector conversion failed, possible invalid constraint for vector type
 
 define hidden void @f(i32* %corr, i32 %order) nounwind ssp {
-  tail call void asm sideeffect "vst1.s32 { ${1:q}, ${2:q} }, [$0]", "r,{q0},{q1}"(i32* %corr, <2 x i64>* undef, <2 x i64>* undef) nounwind, !srcloc !0
+  tail call void asm sideeffect "vst1.s32 { ${1:q}, ${2:q} }, [$0]", "r,{q0},{q1}"(i32* %corr, <2 x i64>* undef, i32 %order) nounwind, !srcloc !0
   ret void
 }
 
diff --git a/test/CodeGen/PowerPC/inline-asm-scalar-to-vector-error.ll b/test/CodeGen/PowerPC/inline-asm-scalar-to-vector-error.ll
new file mode 100644 (file)
index 0000000..3f1d9d3
--- /dev/null
@@ -0,0 +1,14 @@
+; RUN: not llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8a -mattr=+altivec %s -o - 2>&1 | FileCheck %s
+
+define hidden void @f(i32 %x) {
+  ; CHECK: scalar-to-vector conversion failed, possible invalid constraint for vector type
+  tail call void asm sideeffect "nop", "{v1}"(i32 %x) nounwind
+
+  ; CHECK: scalar-to-vector conversion failed, possible invalid constraint for vector type
+  tail call void asm sideeffect "nop", "{vsl1}"(i32 %x) nounwind
+
+  ; CHECK: scalar-to-vector conversion failed, possible invalid constraint for vector type
+  tail call void asm sideeffect "nop", "{vsh1}"(i32 %x) nounwind
+
+  ret void
+}