[llvm] [AA] Take read-only provenance captures into account (PR #143097)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 12 01:41:27 PDT 2025
nikic wrote:
> > Assuming you mean LICM scalar promotion, we already use PointerMayBeCapturedBefore:
> > https://github.com/llvm/llvm-project/blob/6157028fea93ff14af18b173dd01eb431cfb6aef/llvm/lib/Transforms/Scalar/LICM.cpp#L1931-L1933
> >
> > The `CaptureAnalysis::getCapturesBefore()` API is part of the pluggable capture analysis in alias analysis, because it needs to trade off accuracy and performance for different users.
>
> Right, my doubt was mostly about whether it could be legitimate, in principle, to favour getCapturesBefore over PointerMayBeCapturedBefore when doing scalar promotion in LICM (and thus having a new CaptureAnalysis object there too). IIUC, we don't do this as the possible accuracy improvement might not be worth the performance cost.
It's the other way around, using getCapturesBefore() would be less accurate, because it's a cached, approximate analysis, while PointerMayBeCapturedBefore() is precise.
https://github.com/llvm/llvm-project/pull/143097
More information about the llvm-commits
mailing list