This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Improve the coverage of isKnownToBeAPowerOfTwo for vscale
ClosedPublic

Authored by Allen on Aug 3 2023, 6:04 PM.

Details

Summary

this PR tries to match the following pattern, seperate from D156881

%vscale = call i64 @llvm.vscale.i64()
%shift = shl nuw nsw i64 %vscale, 11

Now, we only check the shl recursively when the OrZero is true.

Diff Detail

Event Timeline

Allen created this revision.Aug 3 2023, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 6:04 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Allen requested review of this revision.Aug 3 2023, 6:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 6:04 PM
This revision was not accepted when it landed; it landed in state Needs Review.Aug 3 2023, 6:11 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
nikic added a subscriber: nikic.
nikic added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
2022

This isn't correct. A shift left of vscale can be zero if all bits get shifted out. There is no special interaction between vscale and shl.

I'm going to revert this. Also have patch in the works that should cover this.