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

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 10:45:43 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]] {
----------------
nikic wrote:

I've pushed a fix for this. I'm not passing the Base object to DetermineUseCaptureKind. We can only infer address_is_null if we're comparison the base to null.

It *is* okay to look through inbounds GEPs though, because they preserve nullness. Though InstCombine should optimize away such GEPs anyway, so maybe it's not necessary to explicitly handle here...

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


More information about the cfe-commits mailing list