OSDN Git Service

[IRTranslator] Don't hardcode GEP index type
authorDiana Picus <diana.picus@linaro.org>
Tue, 14 May 2019 09:25:17 +0000 (09:25 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 14 May 2019 09:25:17 +0000 (09:25 +0000)
commit5e300846b97b36ec72245f05599808179345c5b0
treed2d45997f9d753dbef4583bc005e388c11aa9b41
parent3b00c5331f36d02c41df23f8545e002a81080b55
[IRTranslator] Don't hardcode GEP index type

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.

Differential Revision: https://reviews.llvm.org/D61852

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360656 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/GlobalISel/IRTranslator.cpp
test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll