This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Add folds for truncation of vscale
ClosedPublic

Authored by DylanFleming-arm on Aug 4 2021, 5:49 AM.

Diff Detail

Event Timeline

DylanFleming-arm requested review of this revision.Aug 4 2021, 5:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2021, 5:49 AM
sdesmalen added inline comments.Aug 4 2021, 7:13 AM
llvm/test/Transforms/InstCombine/vscale_trunc.ll
5

This test isn't really necessary, if you handle the case for i32 -> i8 for the two edge cases.

16

Three things:

  1. Please inline the vscale attribute here, that makes the test more more readable.
  2. Please test the edge cases:
vscale_range(0, 256) // can't fold.
vscale_range(0, 255) // can be folded.
  1. This name seems wrong: vscale_SExt_i32toi8? (same for the use of SExt in the test below)
28

This test isn't really necessary, if you handle the case for i32 -> i8 for the two edge cases.

39

I'm missing a test for the case where there is no attribute specified.

sdesmalen added inline comments.Aug 4 2021, 7:22 AM
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
971

This also requires a check that MaxVScale > 0, because according to the langref (a value of 0 means unbounded).

Added check for MaxVScale > 0

Removed redundant test and added extra case for no attribute

david-arm accepted this revision.Aug 5 2021, 9:05 AM

LGTM!

This revision is now accepted and ready to land.Aug 5 2021, 9:05 AM
Matt added a subscriber: Matt.Aug 5 2021, 12:52 PM
This revision was landed with ongoing or failed builds.Aug 13 2021, 2:18 AM
This revision was automatically updated to reflect the committed changes.