[llvm] [LowerAllowCheckPass] fix pipeline printing (PR #146000)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 18:10:55 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Florian Mayer (fmayer)

<details>
<summary>Changes</summary>



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


2 Files Affected:

- (modified) llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp (+3-1) 
- (added) llvm/test/Transforms/lower-builtin-allow-check-pipeline.ll (+3) 


``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp
index f6a273262e535..196f58a8f1d1c 100644
--- a/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp
+++ b/llvm/lib/Transforms/Instrumentation/LowerAllowCheckPass.cpp
@@ -182,11 +182,13 @@ void LowerAllowCheckPass::printPipeline(
   // correctness.
   // TODO: print shorter output by combining adjacent runs, etc.
   int i = 0;
+  bool printed = false;
   for (unsigned int cutoff : Opts.cutoffs) {
     if (cutoff > 0) {
-      if (i > 0)
+      if (printed)
         OS << ";";
       OS << "cutoffs[" << i << "]=" << cutoff;
+      printed = true;
     }
 
     i++;
diff --git a/llvm/test/Transforms/lower-builtin-allow-check-pipeline.ll b/llvm/test/Transforms/lower-builtin-allow-check-pipeline.ll
new file mode 100644
index 0000000000000..7b00be97e050c
--- /dev/null
+++ b/llvm/test/Transforms/lower-builtin-allow-check-pipeline.ll
@@ -0,0 +1,3 @@
+; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check<cutoffs[7]=0;cutoffs[8]=1>)' -S -o - -print-pipeline-passes | FileCheck %s
+
+; CHECK: lower-allow-check<cutoffs[8]=1>

``````````

</details>


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


More information about the llvm-commits mailing list