This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Clarify TypeSize comparisons
ClosedPublic

Authored by c-rhodes on Oct 14 2020, 5:15 AM.

Details

Summary

TypeSize comparisons using overloaded operators should be replaced by
the new isKnownXY comparators when the operands can be fixed-length or
scalable vectors.

In ValueTracking there are several uses of the overloaded operators in
isKnownNonZero and ComputeMultiple. In the former we already bail out on
scalable vectors since we currently have no way to represent
DemandedElts, and the latter is operating on scalar integers, so we can
assume fixed-size in both instances.

Diff Detail

Event Timeline

c-rhodes created this revision.Oct 14 2020, 5:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 14 2020, 5:15 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
c-rhodes requested review of this revision.Oct 14 2020, 5:15 AM
david-arm accepted this revision.Oct 15 2020, 12:27 AM

LGTM!

llvm/lib/Analysis/ValueTracking.cpp
2259–2261

In general I think IntToPtr instructions could take scalable vectors as operands, at least looking at InstCombinerImpl::visitIntToPtr suggests that. This is probably ok for now because we bail out for scalable vectors at the top of the function.

This revision is now accepted and ready to land.Oct 15 2020, 12:27 AM
c-rhodes added inline comments.Oct 16 2020, 3:11 AM
llvm/lib/Analysis/ValueTracking.cpp
2259–2261

In general I think IntToPtr instructions could take scalable vectors as operands, at least looking at InstCombinerImpl::visitIntToPtr suggests that. This is probably ok for now because we bail out for scalable vectors at the top of the function.

Yeah it would be a vector of pointers so it should be caught by the existing bail out I think.

This revision was automatically updated to reflect the committed changes.