OSDN Git Service

[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)
commit395b7777955e0c0d999a4dd0260a662b7dc16f4f
tree2d69ed58850f349703f2a8611173851e261c0e16
parentb68371dd25db76363b6b5da5fcd2801ec0ca4479
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321165 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMInstructionSelector.cpp
lib/Target/ARM/ARMRegisterBankInfo.cpp
test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir