[llvm] [AA] Take read-only provenance captures into account (PR #143097)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 01:22:37 PDT 2025


antoniofrighetto 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 why it could be legitimate, in principle, to favour getCapturesBefore over  PointerMayBeCapturedBefore when doing scalar promotion in LICM (and thus having a new CaptureAnalsysis object there too). IIUC, we don't do this as the possible accuracy improvement might not be worth the performance cost.

https://github.com/llvm/llvm-project/pull/143097


More information about the llvm-commits mailing list