OSDN Git Service

GlobalISel: Fix CSE handling of buildConstant
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 4 Feb 2019 19:15:50 +0000 (19:15 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 4 Feb 2019 19:15:50 +0000 (19:15 +0000)
commit74695311606163772d4a0cf53a619171f3c7d380
treed9fd545a44bda21c5a3dcc94ce5671ac3962c0af
parent9ac1c045584659055a0307e9176008b2fcf21c83
GlobalISel: Fix CSE handling of buildConstant

This fixes two problems with CSE done in buildConstant. First, this
would hit an assert when used with a vector result type. Solve this by
allowing CSE on the vector elements, but not on the result vector for
now.

Second, this was also performing the CSE based on the input
ConstantInt pointer. The underlying buildConstant could potentially
convert the constant depending on the result type, giving in a
different ConstantInt*. Stop allowing the APInt and ConstantInt forms
from automatically casting to the result type to avoid any similar
problems in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353077 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
unittests/CodeGen/GlobalISel/CSETest.cpp
unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp