[llvm] [CodeGen][ShrinkWrap] Clarify StackAddressUsedBlockInfo meaning (PR #80679)

Elizaveta Noskova via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 05:35:28 PST 2024


https://github.com/enoskova-sc created https://github.com/llvm/llvm-project/pull/80679

None

>From 47fddd47c3a00af82f7b6c350d34e242fe01bdc6 Mon Sep 17 00:00:00 2001
From: Elizaveta Noskova <elizaveta.noskova at syntacore.com>
Date: Thu, 1 Feb 2024 12:23:07 +0300
Subject: [PATCH] [CodeGen][ShrinkWrap] Clarify StackAddressUsedBlockInfo
 meaning

---
 llvm/lib/CodeGen/ShrinkWrap.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp
index ab57d08e527e4..8127ce1ffa764 100644
--- a/llvm/lib/CodeGen/ShrinkWrap.cpp
+++ b/llvm/lib/CodeGen/ShrinkWrap.cpp
@@ -161,9 +161,9 @@ 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 cannot guarantee that there will
+  /// be no access to the stack or computation of stack-relative addresses on
+  /// any CFG path including the block itself.
   BitVector StackAddressUsedBlockInfo;
 
   /// Check if \p MI uses or defines a callee-saved register or
@@ -948,6 +948,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();



More information about the llvm-commits mailing list