[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 13 06:09:37 PST 2025
nikic wrote:
Thanks for the report! I've reverted the change for now.
```llvm
declare ptr @passthrough(ptr)
define i16 @test() {
%a = alloca i16, align 1
store i16 1, ptr %a, align 1
%call = call ptr @passthrough(ptr readnone captures(ret: address, provenance) %a)
%v = load i16, ptr %call, align 1
ret i16 %v
}
```
We correctly determine that `%a` is not captured, but because of that we miss the indirect access via the load.
I believe the reason is that `isEscapeSource()` will report that this is an escape source, and thus cannot alias with a non-escaped pointer. However, if `captures(ret: address, provenance)` is used, this is not correct. isEscapeSource() already takes isIntrinsicReturningPointerAliasingArgumentWithoutCapturing() into account for essentially the same reason.
https://github.com/llvm/llvm-project/pull/125880
More information about the cfe-commits
mailing list