[llvm] [DFAJumpThreading] Prevent pass from using too much memory. (PR #145482)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 02:37:36 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index ac7af712b..54cf3c523 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -618,7 +618,7 @@ private:
 
     VisitedBlocks UniqueBlocks;
     for (auto *IncomingBB : Phi->blocks()) {
-      if(Res.size() >= MaxNumPaths)
+      if (Res.size() >= MaxNumPaths)
         break;
       if (!UniqueBlocks.insert(IncomingBB).second)
         continue;
@@ -659,7 +659,7 @@ private:
             getPathsFromStateDefMap(StateDef, IncomingPhi, VB);
         for (ThreadingPath &Path : PredPaths) {
           Path.push_back(PhiBB);
-          if(Res.size() >= MaxNumPaths)
+          if (Res.size() >= MaxNumPaths)
             break;
           Res.push_back(std::move(Path));
         }
@@ -683,10 +683,10 @@ private:
           ThreadingPath NewPath(Path);
           NewPath.appendExcludingFirst(IPath);
           NewPath.push_back(PhiBB);
-          if(Res.size() >= MaxNumPaths) {
+          if (Res.size() >= MaxNumPaths) {
             VB.erase(PhiBB);
             return Res;
-	  }
+          }
           Res.push_back(NewPath);
         }
       }

``````````

</details>


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


More information about the llvm-commits mailing list