[PATCH] D55507: [DAGCombiner] Use the result value type in visitCONCAT_VECTORS

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 04:48:10 PST 2018


thegameg created this revision.
thegameg added reviewers: craig.topper, RKSimon, spatel.

This triggers an assert when combining concat_vectors of a bitcast of merge_values.

  Assertion failed: (VT.isVector() && !Operand.getValueType().isVector() && (VT.getVectorElementType() == Operand.getValueType() || (VT.getVectorElementType().isInteger() && Operand.getValueType().isInteger() && VT.getVectorElementType().bitsLE(Operand.getValueType()))) && "Illegal SCALAR_TO_VECTOR node!"), function getNode, file ../lib/CodeGen/SelectionDAG/SelectionDAG.cpp, line 4172.

With asserts disabled, it fails to select:

  fatal error: error in backend: Cannot select: 0x7ff19d000e90: i32 = any_extend 0x7ff19d000ae8
    0x7ff19d000ae8: f64,ch = CopyFromReg 0x7ff19d000c20:1, Register:f64 %1
      0x7ff19d000b50: f64 = Register %1
  In function: d


Repository:
  rL LLVM

https://reviews.llvm.org/D55507

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/combine-concat-vectors.ll


Index: test/CodeGen/X86/combine-concat-vectors.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/combine-concat-vectors.ll
@@ -0,0 +1,27 @@
+; RUN: llc -mtriple=x86_64-- -o - | FileCheck %s
+; Check that this does not fail to combine concat_vectors of a value from
+; merge_values through a bitcast.
+define void @d() personality i8* undef {
+entry:
+  %call16 = invoke { i8, double } undef()
+          to label %bar unwind label %foo
+
+foo:                                              ; preds = %bar, %entry
+  %0 = landingpad { i8*, i32 }
+          cleanup
+  br label %bazr
+
+bar:                                              ; preds = %entry
+  %1 = extractvalue { i8, double } %call16, 1
+  %2 = bitcast double %1 to <2 x float>
+  invoke void undef()
+          to label %baz unwind label %foo
+
+baz:                                              ; preds = %bar
+  %3 = extractelement <2 x float> %2, i64 0
+  br label %bazr
+
+bazr:                                             ; preds = %baz, %foo
+  %exn.obj = extractvalue { i8*, i32 } undef, 0
+  unreachable
+}
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -16515,7 +16515,7 @@
           TLI.isTypeLegal(Scalar->getOperand(0).getValueType()))
         Scalar = Scalar->getOperand(0);
 
-      EVT SclTy = Scalar->getValueType(0);
+      EVT SclTy = Scalar.getValueType();
 
       if (!SclTy.isFloatingPoint() && !SclTy.isInteger())
         return SDValue();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55507.177488.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181210/3332cf20/attachment.bin>


More information about the llvm-commits mailing list