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

via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 07:10:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: GnSight (ftyghome)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/139269.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Utils/PredicateInfo.cpp (+5-5) 


``````````diff
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());

``````````

</details>


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


More information about the llvm-commits mailing list