[SVE][InstCombine] Fix TypeSize warning in canReplaceGEPIdxWithZero
authorJoe Ellis <joe.ellis@arm.com>
Mon, 26 Oct 2020 17:40:25 +0000 (17:40 +0000)
committerJoe Ellis <joe.ellis@arm.com>
Mon, 26 Oct 2020 17:40:26 +0000 (17:40 +0000)
commit0f8350559325db35e0ee3423db5d29113e4eec12
tree29b22f4103661a7e1776eaede816211ddbbe2d80
parent0383a1a8c230581aec4f2d9d4bfb5f5ed32d2bf5
[SVE][InstCombine] Fix TypeSize warning in canReplaceGEPIdxWithZero

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.

Reviewed By: fpetrogalli

Differential Revision: https://reviews.llvm.org/D89968
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/test/Transforms/InstCombine/gep-can-replace-gep-idx-with-zero-typesize.ll [new file with mode: 0644]