[ARM GlobalISel] Fix assertion in RegBankSelect
authorDiana Picus <diana.picus@linaro.org>
Wed, 20 Dec 2017 11:27:10 +0000 (11:27 +0000)
committerDiana Picus <diana.picus@linaro.org>
Wed, 20 Dec 2017 11:27:10 +0000 (11:27 +0000)
commit75ce852abe1bdd49fda09489da0545530e817640
treec53103500c175a9055722d92b6431a2d2b3a2b4b
parentc3aa6d83fd3863170e10db365e93aae7e9351efc
[ARM GlobalISel] Fix assertion in RegBankSelect

We get an assertion in RegBankSelect for code along the lines of
my_32_bit_int = my_64_bit_int, which tends to translate into a 64-bit
load, followed by a G_TRUNC, followed by a 32-bit store. This appears in
a couple of places in the test-suite.

At the moment, the legalizer doesn't distinguish between integer and
floating point scalars, so a 64-bit load will be marked as legal for
targets with VFP, and so will the rest of the sequence, leading to a
slightly bizarre G_TRUNC reaching RegBankSelect.

Since the current support for 64-bit integers is rather immature, this
patch works around the issue by explicitly handling this case in
RegBankSelect and InstructionSelect. In the future, we may want to
revisit this decision and make sure 64-bit integer loads are narrowed
before reaching RegBankSelect.

llvm-svn: 321165
llvm/lib/Target/ARM/ARMInstructionSelector.cpp
llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir