[llvm] [AMDGPU] Improve StructurizeCFG pass performance: avoid redundant DebugLoc map initialization. NFC. (PR #130568)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 10 07:15:41 PDT 2025
================
@@ -990,10 +996,10 @@ BasicBlock *StructurizeCFG::getNextFlow(BasicBlock *Dominator) {
Func, Insert);
FlowSet.insert(Flow);
- // use a temporary variable to avoid a use-after-free if the map's storage is
- // reallocated
- DebugLoc DL = TermDL[Dominator];
- TermDL[Flow] = std::move(DL);
+ auto *Term = Dominator->getTerminator();
+ if (const DebugLoc &DL =
----------------
jmmartinez wrote:
We used to do a copy of the `DebugLoc` because the reference to `TermDL[Dominator]` could be invalidated if the underlying container reallocates a bigger array when we do `TermDL[Flow]`.
Could this issue still happen here? If yes, we would need to do a copy of the `DebugLoc`.
https://github.com/llvm/llvm-project/pull/130568
More information about the llvm-commits
mailing list