[llvm] 4105305 - [DAG] SimplifyVCastOp - ensure we select the correct value type from an SDValue operand
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 02:39:00 PDT 2023
Author: Simon Pilgrim
Date: 2023-04-20T10:38:10+01:00
New Revision: 41053053e37f66fcd4350759b172713c08aa41f0
URL: https://github.com/llvm/llvm-project/commit/41053053e37f66fcd4350759b172713c08aa41f0
DIFF: https://github.com/llvm/llvm-project/commit/41053053e37f66fcd4350759b172713c08aa41f0.diff
LOG: [DAG] SimplifyVCastOp - ensure we select the correct value type from an SDValue operand
As reported on Issue #62234 - we weren't correctly using the SDValue operand to get its value type, resulting in a failure when it came from a SDNode with multiple results
We haven't been able to create a suitable upstream regression test, but its been confirmed by inspection by both myself and @topperc
Fixes #62234
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4bfb8849f7b47..3828f03bdf630 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -25660,8 +25660,6 @@ SDValue DAGCombiner::SimplifyVCastOp(SDNode *N, const SDLoc &DL) {
unsigned Opcode = N->getOpcode();
SDValue N0 = N->getOperand(0);
- EVT SrcVT = N0->getValueType(0);
- EVT SrcEltVT = SrcVT.getVectorElementType();
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
// TODO: promote operation might be also good here?
@@ -25672,6 +25670,8 @@ SDValue DAGCombiner::SimplifyVCastOp(SDNode *N, const SDLoc &DL) {
TLI.isExtractVecEltCheap(VT, Index0)) &&
TLI.isOperationLegalOrCustom(Opcode, EltVT) &&
TLI.preferScalarizeSplat(N)) {
+ EVT SrcVT = N0.getValueType();
+ EVT SrcEltVT = SrcVT.getVectorElementType();
SDValue IndexC = DAG.getVectorIdxConstant(Index0, DL);
SDValue Elt =
DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, SrcEltVT, Src0, IndexC);
More information about the llvm-commits
mailing list