Skip to content

Commit 4dd103e

Browse files
authored
[CodeGen][ShrinkWrap] Clarify StackAddressUsedBlockInfo meaning (#80679)
1 parent cd75178 commit 4dd103e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

llvm/lib/CodeGen/ShrinkWrap.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ class ShrinkWrap : public MachineFunctionPass {
161161
/// Current MachineFunction.
162162
MachineFunction *MachineFunc = nullptr;
163163

164-
/// Is `true` for block numbers where we can guarantee no stack access
165-
/// or computation of stack-relative addresses on any CFG path including
166-
/// the block itself.
164+
/// Is `true` for the block numbers where we assume possible stack accesses
165+
/// or computation of stack-relative addresses on any CFG path including the
166+
/// block itself. Is `false` for basic blocks where we can guarantee the
167+
/// opposite. False positives won't lead to incorrect analysis results,
168+
/// therefore this approach is fair.
167169
BitVector StackAddressUsedBlockInfo;
168170

169171
/// Check if \p MI uses or defines a callee-saved register or
@@ -948,6 +950,9 @@ bool ShrinkWrap::runOnMachineFunction(MachineFunction &MF) {
948950

949951
bool Changed = false;
950952

953+
// Initially, conservatively assume that stack addresses can be used in each
954+
// basic block and change the state only for those basic blocks for which we
955+
// were able to prove the opposite.
951956
StackAddressUsedBlockInfo.resize(MF.getNumBlockIDs(), true);
952957
bool HasCandidate = performShrinkWrapping(RPOT, RS.get());
953958
StackAddressUsedBlockInfo.clear();

0 commit comments

Comments
 (0)