aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AtomicExpandPass.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2024-09-20 08:18:33 +0400
committerGitHub <noreply@github.com>2024-09-20 08:18:33 +0400
commit5326614e2f84677515c38a17cf2f30cf66deaadc (patch)
tree41ffb4aafbb634d86b3d6ee1ffc32782136665cb /llvm/lib/CodeGen/AtomicExpandPass.cpp
parent3d0846bedcd18d546fd3733c93c2e144f2faab09 (diff)
downloadllvm-5326614e2f84677515c38a17cf2f30cf66deaadc.zip
llvm-5326614e2f84677515c38a17cf2f30cf66deaadc.tar.gz
llvm-5326614e2f84677515c38a17cf2f30cf66deaadc.tar.bz2
AtomicExpand: Really allow incremental legalization (#108613)
Fix up 100d9b89947bb1d42af20010bb594fa4c02542fc. 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.
Diffstat (limited to 'llvm/lib/CodeGen/AtomicExpandPass.cpp')
-rw-r--r--llvm/lib/CodeGen/AtomicExpandPass.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index 3030584..3d4e2cb 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -351,9 +351,8 @@ bool AtomicExpandImpl::run(Function &F, const TargetMachine *TM) {
bool MadeChange = false;
- for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE;) {
+ for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
BasicBlock *BB = &*BBI;
- ++BBI;
BasicBlock::reverse_iterator Next;
@@ -365,14 +364,8 @@ bool AtomicExpandImpl::run(Function &F, const TargetMachine *TM) {
if (processAtomicInstr(&Inst)) {
MadeChange = true;
- // Detect control flow change and resume iteration from the original
- // block to inspect any newly inserted blocks. This allows incremental
- // legalization of atomicrmw and cmpxchg.
- if (Next != E && BB != Next->getParent()) {
- BBI = BB->getIterator();
- BBE = F.end();
- break;
- }
+ // New blocks may have been inserted.
+ BBE = F.end();
}
}
}