[PATCH] D153773: ValueTracking: Handle ptrmask in computeKnownBits
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 13:14:12 PDT 2023
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1719
+ const Value *Mask = I->getOperand(1);
+ Known2 = KnownBits(Mask->getType()->getIntegerBitWidth());
+ computeKnownBits(Mask, Known2, Depth + 1, Q);
----------------
arsenm wrote:
> nikic wrote:
> > This will assert if ptrmask is working on vectors.
> 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
>
> ```
Interesting, that seems like an oversight.
I'd still suggest to use getScalarSizeInBits() here for robustness.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153773/new/
https://reviews.llvm.org/D153773
More information about the llvm-commits
mailing list