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.
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.