[llvm] [PredicateInfo] Update comments for PredicateAssume (PR #139269)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 07:09:48 PDT 2025


https://github.com/ftyghome created https://github.com/llvm/llvm-project/pull/139269

Previously, PredicateAssume was modified to materialize after the assume statement rather than before it (See 353fa44). Update relevant comments to match this.

>From c071110348e89faacdd33432c03996a36766f08c Mon Sep 17 00:00:00 2001
From: Zesen Liu <ftyg at live.com>
Date: Fri, 9 May 2025 21:46:49 +0800
Subject: [PATCH] [PredicateInfo] Update comments for PredicateAssume
 Previously, PredicateAssume was modified to materialize after the assume
 statement rather than before it. Update relevant comments to match this.

---
 llvm/lib/Transforms/Utils/PredicateInfo.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
index 9ae10b07147fc..d4b2bcf40fd8a 100644
--- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp
+++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
@@ -546,10 +546,10 @@ Value *PredicateInfoBuilder::materializeStack(unsigned int &Counter,
                              ? OrigOp
                              : (RenameStack.end() - Start - 1)->Def;
     // For edge predicates, we can just place the operand in the block before
-    // the terminator.  For assume, we have to place it right before the assume
-    // to ensure we dominate all of our uses.  Always insert right before the
-    // relevant instruction (terminator, assume), so that we insert in proper
-    // order in the case of multiple predicateinfo in the same block.
+    // the terminator. For assume, we have to place it right after the assume
+    // to ensure we dominate all uses except assume itself. Always insert
+    // right before the terminator or after the assume, so that we insert in
+    // proper order in the case of multiple predicateinfo in the same block.
     // The number of named values is used to detect if a new declaration was
     // added. If so, that declaration is tracked so that it can be removed when
     // the analysis is done. The corner case were a new declaration results in
@@ -622,7 +622,7 @@ void PredicateInfoBuilder::renameUses(SmallVectorImpl<Value *> &OpsToRename) {
       // The predicate info for branches always come first, they will get
       // materialized in the split block at the top of the block.
       // The predicate info for assumes will be somewhere in the middle,
-      // it will get materialized in front of the assume.
+      // it will get materialized right after the assume.
       if (const auto *PAssume = dyn_cast<PredicateAssume>(PossibleCopy)) {
         VD.LocalNum = LN_Middle;
         DomTreeNode *DomNode = DT.getNode(PAssume->AssumeInst->getParent());



More information about the llvm-commits mailing list