[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 09:13:44 PST 2025


================
@@ -774,7 +774,7 @@ define i1 @captureICmpRev(ptr %x) {
 define i1 @nocaptureInboundsGEPICmp(ptr %x) {
 ; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
 ; FNATTRS-LABEL: define i1 @nocaptureInboundsGEPICmp
-; FNATTRS-SAME: (ptr readnone [[X:%.*]]) #[[ATTR0]] {
+; FNATTRS-SAME: (ptr readnone captures(address_is_null) [[X:%.*]]) #[[ATTR0]] {
----------------
goldsteinn wrote:

Is this correct? I get that the `cmp` is somewhat ill-formed (`false`), but I don't see how this ever reduces to an `%x == null` check with a non-zero offset.

Also seems to also apply `address_is_null` w.o `inbounds`:

```
define i1 @nocaptureInboundsGEPICmp(ptr %x, i64 %y) {
  %1 = getelementptr  i8, ptr %x, i64 %y
  %2 = icmp eq ptr %1, null
  ret i1 %2
}
```
=>
```
define i1 @nocaptureInboundsGEPICmp(ptr readnone captures(address_is_null) %x, i64 %y) {
  %1 = getelementptr i8, ptr %x, i64 %y
  %2 = icmp eq ptr %1, null
  ret i1 %2
}
```

How is that correct?

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


More information about the cfe-commits mailing list