[llvm] [AMDGPU][AtomicOptimizer] Fix DT update for divergent values with Iterative strategy (PR #87605)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 01:03:37 PDT 2024
================
@@ -887,10 +887,18 @@ void AMDGPUAtomicOptimizerImpl::optimizeAtomic(Instruction &I,
B.CreateBr(ComputeLoop);
// Update the dominator tree for new control flow.
- DTU.applyUpdates(
+ SmallVector<DominatorTree::UpdateType, 6> DomTreeUpdates(
{{DominatorTree::Insert, EntryBB, ComputeLoop},
- {DominatorTree::Insert, ComputeLoop, ComputeEnd},
- {DominatorTree::Delete, EntryBB, SingleLaneTerminator->getParent()}});
+ {DominatorTree::Insert, ComputeLoop, ComputeEnd}});
+
+ // We're moving the terminator from EntryBB to ComputeEnd, make sure we move
+ // the DT edges as well.
+ for (auto *Succ : Terminator->successors()) {
----------------
jayfoad wrote:
Nit: could you use `ComputeEnd->successors()` here? Then you would not have to explain how `Terminator` is known to be a `BranchInst`.
https://github.com/llvm/llvm-project/pull/87605
More information about the llvm-commits
mailing list