Skip to content

Commit 55dae9c

Browse files
committed
[Statepoints] Style cleanup after 3da1a96 [NFC]
Just fixing a few minor stylistic issues.
1 parent c5b2371 commit 55dae9c

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -678,27 +678,24 @@ lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
678678
SDValue SDV = Builder.getValue(V);
679679
SDValue Loc = Builder.StatepointLowering.getLocation(SDV);
680680

681-
if (LowerAsVReg.count(SDV)) {
682-
SpillMap[V] = None;
683-
} else if (Loc.getNode()) {
681+
if (Loc.getNode()) {
682+
// If this is a value we spilled, remember where for when we visit the
683+
// gc.relocate corresponding to this gc.statepoint
684684
SpillMap[V] = cast<FrameIndexSDNode>(Loc)->getIndex();
685685
} else {
686-
// Record value as visited, but not spilled. This is case for allocas
687-
// and constants. For this values we can avoid emitting spill load while
688-
// visiting corresponding gc_relocate.
689-
// Actually we do not need to record them in this map at all.
690-
// We do this only to check that we are not relocating any unvisited
691-
// value.
686+
// If we didn't spill the value - allocas, constants, and values lowered
687+
// as tied vregs - mark them as visited, but not spilled. Marking them
688+
// visited (as opposed to simply missing in the map), allows tighter
689+
// assertion checking.
692690
SpillMap[V] = None;
693691

694-
// Default llvm mechanisms for exporting values which are used in
695-
// different basic blocks does not work for gc relocates.
696-
// Note that it would be incorrect to teach llvm that all relocates are
697-
// uses of the corresponding values so that it would automatically
698-
// export them. Relocates of the spilled values does not use original
699-
// value.
700-
if (Relocate->getParent() != StatepointInstr->getParent())
692+
// Conservatively export all values used by gc.relocates outside this
693+
// block. This is currently only needed for expressions which don't need
694+
// relocation, but will likely be extended for vreg case shortly.
695+
if (Relocate->getParent() != StatepointInstr->getParent()) {
701696
Builder.ExportFromCurrentBlock(V);
697+
assert(!LowerAsVReg.count(SDV));
698+
}
702699
}
703700
}
704701
}
@@ -844,9 +841,9 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
844841
SmallVector<EVT, 8> NodeTys;
845842
for (auto &Ptr : SI.Ptrs) {
846843
SDValue SD = getValue(Ptr);
847-
if (LowerAsVReg.count(SD)) {
848-
NodeTys.push_back(SD.getValueType());
849-
}
844+
if (!LowerAsVReg.count(SD))
845+
continue;
846+
NodeTys.push_back(SD.getValueType());
850847
}
851848
LLVM_DEBUG(dbgs() << "Statepoint has " << NodeTys.size() << " results\n");
852849
assert(NodeTys.size() == LowerAsVReg.size() && "Inconsistent GC Ptr lowering");
@@ -866,8 +863,9 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
866863
for (const auto *Relocate : SI.GCRelocates) {
867864
Value *Derived = Relocate->getDerivedPtr();
868865
SDValue SD = getValue(Derived);
869-
if (LowerAsVReg.count(SD))
870-
DPtrMap[Derived] = SDValue(StatepointMCNode, LowerAsVReg[SD]);
866+
if (!LowerAsVReg.count(SD))
867+
continue;
868+
DPtrMap[Derived] = SDValue(StatepointMCNode, LowerAsVReg[SD]);
871869
}
872870

873871
// Build the GC_TRANSITION_END node if necessary.

0 commit comments

Comments
 (0)