[PATCH] D153511: [BasicAA] Don't short-circuit non-capturing arguments

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 11:30:47 PDT 2023


fhahn added a comment.

In D153511#4442108 <https://reviews.llvm.org/D153511#4442108>, @aeubanks wrote:

> In D153511#4442041 <https://reviews.llvm.org/D153511#4442041>, @fhahn wrote:
>
>> Hmm, I am a bit worried that fixing this here rather than marking them as capturing in the CaptureTracker leaves a potential door for mis-use of the general API. Perhaps it would be possible to just consider those calls as capturing, as in 
>> D153577 <https://reviews.llvm.org/D153577>
>
> Those calls aren't capturing the pointer though.
>
> Do you mean you're worried about mis-use of the capture tracking API?
>
> I think this makes sense, using capture tracking to infer mod/ref seems backwards. IIUC this analysis depends on `AAQI.CI->isNotCapturedBeforeOrAt()` agreeing with `Call->doesNotCapture()`, which seems brittle.

IIUC the capture tracking here is used more to check whether the pointer escapes. We also have the following code which considers calls as capturing: https://github.com/llvm/llvm-project/blob/88f07a311947f88de82ad2de9b2d6a26eba21343/llvm/lib/Analysis/CaptureTracking.cpp#L314 . For the test case, if the result isn't used in an assume, it is considered capturing the pointer.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153511/new/

https://reviews.llvm.org/D153511



More information about the llvm-commits mailing list