This is an archive of the discontinued LLVM Phabricator instance.

[IRTranslator] Don't hardcode GEP index type
ClosedPublic

Authored by rovka on May 13 2019, 4:18 AM.

Details

Summary

When breaking up loads and stores of aggregates, the IRTranslator uses
LLT::scalar(64) for the index type of the G_GEP instructions that
compute the addresses. This is unnecessarily large for 32-bit targets.
Use the int ptr type provided by the DataLayout instead.

Note that we're already doing the right thing when translating
getelementptr instructions from the IR. This is just an oversight when
generating new ones while translating loads/stores.

Both x86 and AArch64 already have tests confirming that the old
behaviour is preserved for 64-bit targets.

Diff Detail

Repository
rL LLVM

Event Timeline

rovka created this revision.May 13 2019, 4:18 AM
This revision is now accepted and ready to land.May 13 2019, 12:58 PM
This revision was automatically updated to reflect the committed changes.