[llvm] [SandboxVec][BottomUpVec] Fix ownership of Legality (PR #143018)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 12:07:28 PDT 2025
================
@@ -498,9 +498,10 @@ bool BottomUpVec::runOnRegion(Region &Rgn, const Analyses &A) {
assert(SeedSlice.size() >= 2 && "Bad slice!");
Function &F = *SeedSlice[0]->getParent()->getParent();
IMaps = std::make_unique<InstrMaps>();
- Legality = std::make_unique<LegalityAnalysis>(
+ auto LegalityPtr = std::make_unique<LegalityAnalysis>(
A.getAA(), A.getScalarEvolution(), F.getParent()->getDataLayout(),
F.getContext(), *IMaps);
+ Legality = LegalityPtr.get();
----------------
slackito wrote:
Wouldn't the `Legality` member become a dangling pointer after the function returns and `LegalityPtr` is destroyed?
https://github.com/llvm/llvm-project/pull/143018
More information about the llvm-commits
mailing list