@@ -385,17 +385,6 @@ namespace {
385
385
bool getTruncatedStoreValue(StoreSDNode *ST, SDValue &Val);
386
386
bool extendLoadedValueToExtension(LoadSDNode *LD, SDValue &Val);
387
387
388
- /// Replace an ISD::EXTRACT_VECTOR_ELT of a load with a narrowed
389
- /// load.
390
- ///
391
- /// \param EVE ISD::EXTRACT_VECTOR_ELT to be replaced.
392
- /// \param InVecVT type of the input vector to EVE with bitcasts resolved.
393
- /// \param EltNo index of the vector element to load.
394
- /// \param OriginalLoad load that EVE came from to be replaced.
395
- /// \returns EVE on success SDValue() on failure.
396
- SDValue scalarizeExtractedVectorLoad(SDNode *EVE, EVT InVecVT,
397
- SDValue EltNo,
398
- LoadSDNode *OriginalLoad);
399
388
void ReplaceLoadWithPromotedLoad(SDNode *Load, SDNode *ExtLoad);
400
389
SDValue PromoteOperand(SDValue Op, EVT PVT, bool &Replace);
401
390
SDValue SExtPromoteOperand(SDValue Op, EVT PVT);
@@ -22720,81 +22709,6 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
22720
22709
return SDValue();
22721
22710
}
22722
22711
22723
- SDValue DAGCombiner::scalarizeExtractedVectorLoad(SDNode *EVE, EVT InVecVT,
22724
- SDValue EltNo,
22725
- LoadSDNode *OriginalLoad) {
22726
- assert(OriginalLoad->isSimple());
22727
-
22728
- EVT ResultVT = EVE->getValueType(0);
22729
- EVT VecEltVT = InVecVT.getVectorElementType();
22730
-
22731
- // If the vector element type is not a multiple of a byte then we are unable
22732
- // to correctly compute an address to load only the extracted element as a
22733
- // scalar.
22734
- if (!VecEltVT.isByteSized())
22735
- return SDValue();
22736
-
22737
- ISD::LoadExtType ExtTy =
22738
- ResultVT.bitsGT(VecEltVT) ? ISD::EXTLOAD : ISD::NON_EXTLOAD;
22739
- if (!TLI.isOperationLegalOrCustom(ISD::LOAD, VecEltVT) ||
22740
- !TLI.shouldReduceLoadWidth(OriginalLoad, ExtTy, VecEltVT))
22741
- return SDValue();
22742
-
22743
- Align Alignment = OriginalLoad->getAlign();
22744
- MachinePointerInfo MPI;
22745
- SDLoc DL(EVE);
22746
- if (auto *ConstEltNo = dyn_cast<ConstantSDNode>(EltNo)) {
22747
- int Elt = ConstEltNo->getZExtValue();
22748
- unsigned PtrOff = VecEltVT.getSizeInBits() * Elt / 8;
22749
- MPI = OriginalLoad->getPointerInfo().getWithOffset(PtrOff);
22750
- Alignment = commonAlignment(Alignment, PtrOff);
22751
- } else {
22752
- // Discard the pointer info except the address space because the memory
22753
- // operand can't represent this new access since the offset is variable.
22754
- MPI = MachinePointerInfo(OriginalLoad->getPointerInfo().getAddrSpace());
22755
- Alignment = commonAlignment(Alignment, VecEltVT.getSizeInBits() / 8);
22756
- }
22757
-
22758
- unsigned IsFast = 0;
22759
- if (!TLI.allowsMemoryAccess(*DAG.getContext(), DAG.getDataLayout(), VecEltVT,
22760
- OriginalLoad->getAddressSpace(), Alignment,
22761
- OriginalLoad->getMemOperand()->getFlags(),
22762
- &IsFast) ||
22763
- !IsFast)
22764
- return SDValue();
22765
-
22766
- SDValue NewPtr = TLI.getVectorElementPointer(DAG, OriginalLoad->getBasePtr(),
22767
- InVecVT, EltNo);
22768
-
22769
- // We are replacing a vector load with a scalar load. The new load must have
22770
- // identical memory op ordering to the original.
22771
- SDValue Load;
22772
- if (ResultVT.bitsGT(VecEltVT)) {
22773
- // If the result type of vextract is wider than the load, then issue an
22774
- // extending load instead.
22775
- ISD::LoadExtType ExtType =
22776
- TLI.isLoadExtLegal(ISD::ZEXTLOAD, ResultVT, VecEltVT) ? ISD::ZEXTLOAD
22777
- : ISD::EXTLOAD;
22778
- Load = DAG.getExtLoad(ExtType, DL, ResultVT, OriginalLoad->getChain(),
22779
- NewPtr, MPI, VecEltVT, Alignment,
22780
- OriginalLoad->getMemOperand()->getFlags(),
22781
- OriginalLoad->getAAInfo());
22782
- DAG.makeEquivalentMemoryOrdering(OriginalLoad, Load);
22783
- } else {
22784
- // The result type is narrower or the same width as the vector element
22785
- Load = DAG.getLoad(VecEltVT, DL, OriginalLoad->getChain(), NewPtr, MPI,
22786
- Alignment, OriginalLoad->getMemOperand()->getFlags(),
22787
- OriginalLoad->getAAInfo());
22788
- DAG.makeEquivalentMemoryOrdering(OriginalLoad, Load);
22789
- if (ResultVT.bitsLT(VecEltVT))
22790
- Load = DAG.getNode(ISD::TRUNCATE, DL, ResultVT, Load);
22791
- else
22792
- Load = DAG.getBitcast(ResultVT, Load);
22793
- }
22794
- ++OpsNarrowed;
22795
- return Load;
22796
- }
22797
-
22798
22712
/// Transform a vector binary operation into a scalar binary operation by moving
22799
22713
/// the math/logic after an extract element of a vector.
22800
22714
static SDValue scalarizeExtractedBinOp(SDNode *ExtElt, SelectionDAG &DAG,
@@ -23362,7 +23276,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
23362
23276
if (Elt == -1)
23363
23277
return DAG.getUNDEF(LVT);
23364
23278
23365
- return scalarizeExtractedVectorLoad(N, VecVT, Index, LN0);
23279
+ return TLI. scalarizeExtractedVectorLoad(LVT, DL, VecVT, Index, LN0, DAG );
23366
23280
}
23367
23281
23368
23282
// Simplify (build_vec (ext )) to (bitcast (build_vec ))
0 commit comments