This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Handle ptrmask in computeKnownBits
ClosedPublic

Authored by arsenm on Jun 26 2023, 7:47 AM.

Details

Diff Detail

Event Timeline

arsenm created this revision.Jun 26 2023, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 7:47 AM
arsenm requested review of this revision.Jun 26 2023, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2023, 7:47 AM
Herald added a subscriber: wdng. · View Herald Transcript
nikic added inline comments.Jun 26 2023, 8:02 AM
llvm/lib/Analysis/ValueTracking.cpp
1719

This will assert if ptrmask is working on vectors.

arsenm added inline comments.Jun 26 2023, 10:23 AM
llvm/lib/Analysis/ValueTracking.cpp
1719

It seems to not work on vectors:

declare <2 x ptr> @llvm.ptrmask.v2p0.v2i64(<2 x ptr>, <2 x i64>)
define <2 x ptr> @ptrmask_align4_ptr_align1_vector(<2 x ptr> %ptr) {
   %ptrmask = call <2 x ptr> @llvm.ptrmask.v2p0.v2i64(<2 x ptr> %ptr, <2 x i64> <i64 -4, i64 -4>)
   ret <2 x ptr> %ptrmask
}

Intrinsic has incorrect return type!
ptr @llvm.ptrmask.v2p0.v2i64
nikic accepted this revision.Jun 26 2023, 1:14 PM

LGTM

llvm/lib/Analysis/ValueTracking.cpp
1719

Interesting, that seems like an oversight.

I'd still suggest to use getScalarSizeInBits() here for robustness.

This revision is now accepted and ready to land.Jun 26 2023, 1:14 PM