This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Handle ptrmask in isKnownNeverZero
AbandonedPublic

Authored by arsenm on Jun 26 2023, 4:48 AM.

Details

Summary

The non-0 address space cases demonstrate the existing confused
behavior of nonnull for the underlying pointer argument.

Diff Detail

Event Timeline

arsenm created this revision.Jun 26 2023, 4:48 AM
arsenm requested review of this revision.Jun 26 2023, 4:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 4:48 AM
Herald added a subscriber: wdng. · View Herald Transcript
nikic requested changes to this revision.Jun 26 2023, 5:10 AM

This doesn't look correct to me. Consider something like ptrmask(ptr, 3) where ptr is nonnull align 4. The ptrmask result will always be a null pointer, even though both inputs are non-null.

This revision now requires changes to proceed.Jun 26 2023, 5:10 AM
fhahn added a comment.Jun 26 2023, 5:13 AM

I think you'd need to also check that there's at least one common non-null bit for both pointer and mask.

arsenm abandoned this revision.Jun 26 2023, 7:47 AM

I think you'd need to also check that there's at least one common non-null bit for both pointer and mask.

I got here because I wanted to handle this in computeKnownBits and was trying to craft a test, I guess I'll just directly do that instead