This is an archive of the discontinued LLVM Phabricator instance.

Don't try to fold gep when the idx is a vector
ClosedPublic

Authored by davide on Jul 27 2017, 2:34 PM.

Details

Summary

The code in ConstantFoldGetElementPtr() assumes integer, and therefore it crashes trying to get the integer bidwith of a vector type (in this case <4 x i32>. I just changed the code to prevent the folding in case of vectors and I didn't bother to generalize as this doesn't seem to me something that really happens in practice, but I'm willing to change the patch if you think it's worth it.
This is hard to trigger from -instsimplify or -instcombine only as the second instruction is dead, so the test uses loop-unroll.

Diff Detail

Repository
rL LLVM

Event Timeline

davide created this revision.Jul 27 2017, 2:34 PM
davide updated this revision to Diff 108530.Jul 27 2017, 3:00 PM

Update comment(s).

RKSimon accepted this revision.Jul 27 2017, 3:12 PM

LGTM

This revision is now accepted and ready to land.Jul 27 2017, 3:12 PM
This revision was automatically updated to reflect the committed changes.