[llvm] r348574 - [SelectionDAG] Don't pass on DemandedElts when handling SCALAR_TO_VECTOR
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 7 01:18:44 PST 2018
Author: rksimon
Date: Fri Dec 7 01:18:44 2018
New Revision: 348574
URL: http://llvm.org/viewvc/llvm-project?rev=348574&view=rev
Log:
[SelectionDAG] Don't pass on DemandedElts when handling SCALAR_TO_VECTOR
Fixes an assertion:
llc: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2200: llvm::KnownBits llvm::SelectionDAG::computeKnownBits(llvm::SDValue, const llvm::APInt&, unsigned int) const: Assertion `(!Op.getValueType().isVector() || NumElts == Op.getValueType().getVectorNumElements()) && "Unexpected vector size"' failed.
Committed on behalf of: @pendingchaos (Rhys Perry)
Differential Revision: https://reviews.llvm.org/D55223
Added:
llvm/trunk/test/CodeGen/AMDGPU/computeKnownBits-scalar-to-vector-crash.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=348574&r1=348573&r2=348574&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Dec 7 01:18:44 2018
@@ -2352,7 +2352,7 @@ KnownBits SelectionDAG::computeKnownBits
break;
SDValue N0 = Op.getOperand(0);
- Known = computeKnownBits(N0, DemandedElts, Depth + 1);
+ Known = computeKnownBits(N0, Depth + 1);
if (N0.getValueSizeInBits() != BitWidth)
Known = Known.trunc(BitWidth);
Added: llvm/trunk/test/CodeGen/AMDGPU/computeKnownBits-scalar-to-vector-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/computeKnownBits-scalar-to-vector-crash.ll?rev=348574&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/computeKnownBits-scalar-to-vector-crash.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/computeKnownBits-scalar-to-vector-crash.ll Fri Dec 7 01:18:44 2018
@@ -0,0 +1,11 @@
+; RUN: llc -march=amdgcn -mcpu=gfx802 -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK: s_waitcnt
+define <2 x i16> @main(<2 x float>) #0 {
+ %2 = bitcast <2 x float> %0 to <4 x i16>
+ %3 = shufflevector <4 x i16> %2, <4 x i16> undef, <2 x i32> <i32 0, i32 undef>
+ %4 = extractelement <4 x i16> %2, i32 0
+ %5 = insertelement <2 x i16> %3, i16 %4, i32 0
+ ret <2 x i16> %5
+}
+
More information about the llvm-commits
mailing list