File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -996,10 +996,13 @@ BasicBlock *StructurizeCFG::getNextFlow(BasicBlock *Dominator) {
996996 Func, Insert);
997997 FlowSet.insert (Flow);
998998
999- auto *Term = Dominator->getTerminator ();
1000- if (const DebugLoc &DL =
1001- Term ? Term->getDebugLoc () : TermDL.lookup (Dominator))
1002- TermDL[Flow] = DL;
999+ if (auto *Term = Dominator->getTerminator ()) {
1000+ if (const DebugLoc &DL = Term->getDebugLoc ())
1001+ TermDL[Flow] = DL;
1002+ } else if (DebugLoc DLTemp = TermDL.lookup (Dominator))
1003+ // use a temporary variable to avoid a use-after-free if the map's storage
1004+ // is reallocated
1005+ TermDL[Flow] = DLTemp;
10031006
10041007 DT->addNewBlock (Flow, Dominator);
10051008 ParentRegion->getRegionInfo ()->setRegionFor (Flow, ParentRegion);
You can’t perform that action at this time.
0 commit comments