This is an archive of the discontinued LLVM Phabricator instance.

[SVE][InstCombine] Fix TypeSize warning in canReplaceGEPIdxWithZero
ClosedPublic

Authored by joechrisellis on Oct 22 2020, 8:52 AM.

Details

Summary

The warning would fire when calling canReplaceGEPIdxWithZero on a GEP
whose source element type is a scalable vector. The size of scalable
vector types is not known, so this optimization cannot be performed.

This patch fixes the issue by:

  • bailing out early in this routine if the GEP instruction's source element type is a scalable vector.
  • making use of getFixedSize -- this removes the dependency on the deprecated interface.

Diff Detail

Event Timeline

joechrisellis created this revision.Oct 22 2020, 8:52 AM
joechrisellis requested review of this revision.Oct 22 2020, 8:52 AM

Oops -- be sure to use getFixedSize.

fpetrogalli accepted this revision.Oct 23 2020, 6:22 AM

LGTM! Thanks.

This revision is now accepted and ready to land.Oct 23 2020, 6:22 AM
This revision was landed with ongoing or failed builds.Oct 26 2020, 10:41 AM
This revision was automatically updated to reflect the committed changes.
sdesmalen added inline comments.
llvm/test/Transforms/InstCombine/gep-can-replace-gep-idx-with-zero-typesize.ll
2

You should make the tests more specific than running with -O2 because it is not explicitly defined what passes are run at -O2 In this case you're fixing InstCombine, so the test should use opt -S -instcombine.