From 2d0fcf786c5c7f384e30a955d2e7da46d1f98949 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Wed, 22 Jan 2020 09:01:22 -0800 Subject: [PATCH] Precommit NFC part of DAGCombiner change. NFC. This is NFC part of DAGCombiner::visitEXTRACT_SUBVECTOR() change in the D73132. --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 97437c6a56f2..3d01e55b7809 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18565,16 +18565,18 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) { unsigned DestSrcRatio = DestNumElts / SrcNumElts; if ((NVT.getVectorNumElements() % DestSrcRatio) == 0) { unsigned NewExtNumElts = NVT.getVectorNumElements() / DestSrcRatio; - EVT NewExtVT = EVT::getVectorVT(*DAG.getContext(), - SrcVT.getScalarType(), NewExtNumElts); - if ((N->getConstantOperandVal(1) % DestSrcRatio) == 0 && - TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NewExtVT)) { - unsigned IndexValScaled = N->getConstantOperandVal(1) / DestSrcRatio; + EVT ScalarVT = SrcVT.getScalarType(); + if ((N->getConstantOperandVal(1) % DestSrcRatio) == 0) { SDLoc DL(N); - SDValue NewIndex = DAG.getVectorIdxConstant(IndexValScaled, DL); - SDValue NewExtract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewExtVT, - V.getOperand(0), NewIndex); - return DAG.getBitcast(NVT, NewExtract); + unsigned IndexValScaled = N->getConstantOperandVal(1) / DestSrcRatio; + EVT NewExtVT = EVT::getVectorVT(*DAG.getContext(), + ScalarVT, NewExtNumElts); + if (TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NewExtVT)) { + SDValue NewIndex = DAG.getVectorIdxConstant(IndexValScaled, DL); + SDValue NewExtract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewExtVT, + V.getOperand(0), NewIndex); + return DAG.getBitcast(NVT, NewExtract); + } } } }