[PATCH] D98324: [Statepoint Lowering] Fix the crash with gc.relocate lowering when it is in a separate block
Denis Antrushin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 10 01:55:39 PST 2021
dantrushin accepted this revision.
dantrushin added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp:1257
// See the handling in spillIncomingValueForStatepoint for detail.
- if (Record.type == RecordType::NoRelocate) {
- setValue(&Relocate, SD);
- return;
- }
-
- assert(Record.type == RecordType::Spill);
-
- unsigned Index = Record.payload.FI;;
- SDValue SpillSlot = DAG.getTargetFrameIndex(Index, getFrameIndexTy());
-
- // All the reloads are independent and are reading memory only modified by
- // statepoints (i.e. no other aliasing stores); informing SelectionDAG of
- // this this let's CSE kick in for free and allows reordering of instructions
- // if possible. The lowering for statepoint sets the root, so this is
- // ordering all reloads with the either a) the statepoint node itself, or b)
- // the entry of the current block for an invoke statepoint.
- const SDValue Chain = DAG.getRoot(); // != Builder.getRoot()
-
- auto &MF = DAG.getMachineFunction();
- auto &MFI = MF.getFrameInfo();
- auto PtrInfo = MachinePointerInfo::getFixedStack(MF, Index);
- auto *LoadMMO = MF.getMachineMemOperand(PtrInfo, MachineMemOperand::MOLoad,
- MFI.getObjectSize(Index),
- MFI.getObjectAlign(Index));
-
- auto LoadVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
- Relocate.getType());
-
- SDValue SpillLoad = DAG.getLoad(LoadVT, getCurSDLoc(), Chain,
- SpillSlot, LoadMMO);
- PendingLoads.push_back(SpillLoad.getValue(1));
-
- assert(SpillLoad.getNode());
- setValue(&Relocate, SpillLoad);
+ assert(Record.type == RecordType::NoRelocate);
+ setValue(&Relocate, SD);
----------------
Could you check that `SD.isUndef` case will have NoRelocate record type too? If so, assert can be moved a bit higher.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98324/new/
https://reviews.llvm.org/D98324
More information about the llvm-commits
mailing list