Skip to content

Commit 2248cdf

Browse files
authored
[Arm] Fix UAF in ARMConstantIslandPass (#146232)
#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 cause the buildbot error. e.g., https://lab.llvm.org/buildbot/#/builders/24/builds/9943 https://lab.llvm.org/buildbot/#/builders/169/builds/12570 Use make_early_inc_range to fix the issue
1 parent c9cdc33 commit 2248cdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/ARM/ARMConstantIslandPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &mf) {
476476

477477
LLVM_DEBUG(dbgs() << "Beginning BR iteration #" << NoBRIters << '\n');
478478
bool BRChange = false;
479-
for (ImmBranch &Br : ImmBranches)
479+
for (ImmBranch &Br : llvm::make_early_inc_range(ImmBranches))
480480
BRChange |= fixupImmediateBr(Br);
481481
if (BRChange && ++NoBRIters > 30)
482482
report_fatal_error("Branch Fix Up pass failed to converge!");

0 commit comments

Comments
 (0)