[llvm] [Bitcode] Fix stack overflow by converting predictValueUseListOrder to non-recursive style (PR #213557)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 2 10:03:03 PDT 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index e43eeee1f..92bb9e9c8 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -253,8 +253,8 @@ static void predictValueUseListOrder(const Value *V, const Function *F,
 
     // Do the actual prediction.
     IDPair.second = true;
-    if (!TopValue->use_empty()
-    && std::next(TopValue->use_begin()) != TopValue->use_end())
+    if (!TopValue->use_empty() &&
+        std::next(TopValue->use_begin()) != TopValue->use_end())
       predictValueUseListOrderImpl(TopValue, F, IDPair.first, OM, Stack);
 
     if (const Constant *C = dyn_cast<Constant>(TopValue)) {

``````````

</details>


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


More information about the llvm-commits mailing list