[PATCH] D57651: GlobalISel: Fix CSE handling of buildConstant

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 3 06:56:44 PST 2019


arsenm created this revision.
arsenm added reviewers: aditya_nandakumar, aemerson, paquette, volkan, dsanders.
Herald added subscribers: Petar.Avramovic, kristof.beyls, rovka, wdng.

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.


https://reviews.llvm.org/D57651

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57651.184950.patch
Type: text/x-patch
Size: 11902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190203/1471789c/attachment-0001.bin>


More information about the llvm-commits mailing list