This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Make ConstantFoldGetElementPtr work for scalable vectors of indices
ClosedPublic

Authored by david-arm on Jun 19 2020, 6:52 AM.

Details

Summary

This patch fixes a compiler crash that was hit when trying to simplify
the following code:

getelementptr [2 x i64], [2 x i64]* null, i64 0, <vscale x 2 x i64> zeroinitializer

For the case where we have a null pointer value like above, we just
need to ensure we don't assume the indices are always fixed width.

Diff Detail

Event Timeline

david-arm created this revision.Jun 19 2020, 6:52 AM
Herald added a project: Restricted Project. · View Herald Transcript
fpetrogalli added inline comments.Jun 19 2020, 8:23 AM
llvm/test/Transforms/InstSimplify/gep.ll
173

Don't you want to test what IR is generated? Mostly for consistency with the other tests. It also helps understanding what is the expected output for GEP mixing fixed vectors, scalars and scalable vectors.

david-arm marked an inline comment as done.Jun 19 2020, 8:40 AM
david-arm added inline comments.
llvm/test/Transforms/InstSimplify/gep.ll
173

Yes you're right. I missed that for some reason. I'll push up a new patch. Thanks for spotting it!

david-arm updated this revision to Diff 272094.Jun 19 2020, 8:48 AM
david-arm marked an inline comment as done.
  • Added full CHECK lines for new test
fpetrogalli accepted this revision.Jun 23 2020, 8:20 PM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 23 2020, 8:20 PM
This revision was automatically updated to reflect the committed changes.