[llvm] r348759 - [DAGCombiner] Use the result value type in visitCONCAT_VECTORS

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 06:31:34 PST 2018


Author: thegameg
Date: Mon Dec 10 06:31:34 2018
New Revision: 348759

URL: http://llvm.org/viewvc/llvm-project?rev=348759&view=rev
Log:
[DAGCombiner] Use the result value type in visitCONCAT_VECTORS

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

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

Differential Revision: https://reviews.llvm.org/D55507

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/X86/combine-concatvectors.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=348759&r1=348758&r2=348759&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 10 06:31:34 2018
@@ -16544,7 +16544,7 @@ SDValue DAGCombiner::visitCONCAT_VECTORS
           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();

Modified: llvm/trunk/test/CodeGen/X86/combine-concatvectors.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combine-concatvectors.ll?rev=348759&r1=348758&r2=348759&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/combine-concatvectors.ll (original)
+++ llvm/trunk/test/CodeGen/X86/combine-concatvectors.ll Mon Dec 10 06:31:34 2018
@@ -16,3 +16,44 @@ define void @PR32957(<2 x float>* %in, <
   store <8 x float> %ins2, <8 x float>* %out, align 32
   ret void
 }
+
+; 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 {
+; CHECK-LABEL: d:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    pushq %rax
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NEXT:  .Ltmp0:
+; CHECK-NEXT:    callq *%rax
+; CHECK-NEXT:  .Ltmp1:
+; CHECK-NEXT:  # %bb.1: # %bar
+; CHECK-NEXT:  .Ltmp2:
+; CHECK-NEXT:    callq *%rax
+; CHECK-NEXT:  .Ltmp3:
+; CHECK-NEXT:  # %bb.2: # %baz
+; CHECK-NEXT:  .LBB1_3: # %foo
+; CHECK-NEXT:  .Ltmp4:
+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
+}




More information about the llvm-commits mailing list