diff options
author | Elizaveta Noskova <159026035+enoskova-sc@users.noreply.github.com> | 2024-04-03 11:22:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 11:22:43 +0300 |
commit | 4dd103e9c65de7d3dbf12e76fbb72724127ec325 (patch) | |
tree | 9f515d40f2cabcdeddb73e4a2e85085497de230c | |
parent | cd7517859eef14d8b38cec2d52c0625a58c645a2 (diff) | |
download | llvm-4dd103e9c65de7d3dbf12e76fbb72724127ec325.zip llvm-4dd103e9c65de7d3dbf12e76fbb72724127ec325.tar.gz llvm-4dd103e9c65de7d3dbf12e76fbb72724127ec325.tar.bz2 |
[CodeGen][ShrinkWrap] Clarify StackAddressUsedBlockInfo meaning (#80679)
-rw-r--r-- | llvm/lib/CodeGen/ShrinkWrap.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp index ab57d08..a4b2299 100644 --- a/llvm/lib/CodeGen/ShrinkWrap.cpp +++ b/llvm/lib/CodeGen/ShrinkWrap.cpp @@ -161,9 +161,11 @@ class ShrinkWrap : public MachineFunctionPass { /// Current MachineFunction. MachineFunction *MachineFunc = nullptr; - /// Is `true` for block numbers where we can guarantee no stack access - /// or computation of stack-relative addresses on any CFG path including - /// the block itself. + /// Is `true` for the block numbers where we assume possible stack accesses + /// or computation of stack-relative addresses on any CFG path including the + /// block itself. Is `false` for basic blocks where we can guarantee the + /// opposite. False positives won't lead to incorrect analysis results, + /// therefore this approach is fair. BitVector StackAddressUsedBlockInfo; /// Check if \p MI uses or defines a callee-saved register or @@ -948,6 +950,9 @@ bool ShrinkWrap::runOnMachineFunction(MachineFunction &MF) { bool Changed = false; + // Initially, conservatively assume that stack addresses can be used in each + // basic block and change the state only for those basic blocks for which we + // were able to prove the opposite. StackAddressUsedBlockInfo.resize(MF.getNumBlockIDs(), true); bool HasCandidate = performShrinkWrapping(RPOT, RS.get()); StackAddressUsedBlockInfo.clear(); |