Skip to content

Commit 5326614

Browse files
authored
AtomicExpand: Really allow incremental legalization (#108613)
Fix up 100d9b8. The iterator fixes ended up defeating the point, since newly inserted blocks were not visited. This never erases the current block, so we can simply not preincrement the block iterator. The AArch64 FP atomic tests now expand the cmpxchg in the second round of legalization.
1 parent 3d0846b commit 5326614

File tree

5 files changed

+815
-690
lines changed

5 files changed

+815
-690
lines changed

llvm/lib/CodeGen/AtomicExpandPass.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,8 @@ bool AtomicExpandImpl::run(Function &F, const TargetMachine *TM) {
351351

352352
bool MadeChange = false;
353353

354-
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE;) {
354+
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
355355
BasicBlock *BB = &*BBI;
356-
++BBI;
357356

358357
BasicBlock::reverse_iterator Next;
359358

@@ -365,14 +364,8 @@ bool AtomicExpandImpl::run(Function &F, const TargetMachine *TM) {
365364
if (processAtomicInstr(&Inst)) {
366365
MadeChange = true;
367366

368-
// Detect control flow change and resume iteration from the original
369-
// block to inspect any newly inserted blocks. This allows incremental
370-
// legalization of atomicrmw and cmpxchg.
371-
if (Next != E && BB != Next->getParent()) {
372-
BBI = BB->getIterator();
373-
BBE = F.end();
374-
break;
375-
}
367+
// New blocks may have been inserted.
368+
BBE = F.end();
376369
}
377370
}
378371
}

0 commit comments

Comments
 (0)