[llvm] [Arm] Fix UAF in https://github.com/llvm/llvm-project/pull/146198 (PR #146232)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 11:37:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: Qinkun Bao (qinkunbao)

<details>
<summary>Changes</summary>

https://github.com/llvm/llvm-project/pull/146198 changes
```
    for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
      BRChange |= fixupImmediateBr(ImmBranches[i]);
```
to
```
    for (ImmBranch &Br : ImmBranches)
      BRChange |= fixupImmediateBr(Br);
```
Unfortunately, they are not NFC and causes the buildbot error. e.g.,
https://lab.llvm.org/buildbot/#/builders/24/builds/9943
https://lab.llvm.org/buildbot/#/builders/169/builds/12570
Revoke the change to fix the bot.


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


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMConstantIslandPass.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index e72aa8ef051cd..ca3dc15ff3ad6 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -476,8 +476,8 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &mf) {
 
     LLVM_DEBUG(dbgs() << "Beginning BR iteration #" << NoBRIters << '\n');
     bool BRChange = false;
-    for (ImmBranch &Br : ImmBranches)
-      BRChange |= fixupImmediateBr(Br);
+    for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
+      BRChange |= fixupImmediateBr(ImmBranches[i]);
     if (BRChange && ++NoBRIters > 30)
       report_fatal_error("Branch Fix Up pass failed to converge!");
     LLVM_DEBUG(dumpBBs());

``````````

</details>


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


More information about the llvm-commits mailing list