[PATCH] D105624: [SelectionDAG] Simplify PromoteIntRes_INSERT_SUBVECTOR to only handle result
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 08:13:06 PDT 2021
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:4745
EVT SubVecVT = SubVec.getValueType();
+ EVT NSubVT = SubVecVT.changeVectorElementType(NOutVT.getVectorElementType());
----------------
I'm not sure we should use changeVectorElementType here. If SubVecVT is an MVT, changeVectorElementType will only work if NSubVT can also be represented as an MVT. I don't think that's guaranteed so `EVT::getVectorVT(NOutV.getVectorElementType(), SubVecVT.getVectorElementCount())` would be better.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:4747
- // To insert SubVec into Vec, store the wider vector to memory, overwrite the
- // appropriate bits with the narrower vector, and reload.
- Align SmallestAlign = DAG.getReducedAlign(SubVecVT, /*UseABI=*/false);
-
- SDValue StackPtr =
- DAG.CreateStackTemporary(VecVT.getStoreSize(), SmallestAlign);
- auto StackPtrVT = StackPtr->getValueType(0);
- auto &MF = DAG.getMachineFunction();
- auto FrameIndex = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
- auto PtrInfo = MachinePointerInfo::getFixedStack(MF, FrameIndex);
-
- SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, PtrInfo,
- SmallestAlign);
-
- SDValue ScaledIdx = Idx;
- if (SubVecVT.isScalableVector() && IdxN != 0) {
- APInt IdxAPInt = cast<ConstantSDNode>(Idx)->getAPIntValue();
- ScaledIdx = DAG.getVScale(dl, StackPtrVT,
- IdxAPInt.sextOrSelf(StackPtrVT.getSizeInBits()));
- }
+ Vec = DAG.getNode(ISD::ANY_EXTEND, dl, NOutVT, Vec);
+ SubVec = DAG.getNode(ISD::ANY_EXTEND, dl, NSubVT, SubVec);
----------------
This can be `Vec = GetPromotedInteger(Vec)` to get the already legalized value for that operand.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105624/new/
https://reviews.llvm.org/D105624
More information about the llvm-commits
mailing list