[PATCH] D70922: [GlobalISel]: Allow targets to override how to widen constants during legalization

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 13:24:41 PST 2019


aditya_nandakumar created this revision.
aditya_nandakumar added reviewers: arsenm, dsanders, volkan, aemerson, paquette.
Herald added subscribers: Petar.Avramovic, atanasyan, hiraditya, rovka, wdng, sdardis.
Herald added a project: LLVM.

This adds a hook to allow targets to define exactly what extension operation should be performed for widening constants. This handles cases like widening i1 true which would end up becoming -1 which affects code quality during combines.
Additionally, in order to stay consistent with how DAG is promoting constants, we now signextend for byte sized types and zero extend otherwise (by default). Targets can of course override this if necessary.


https://reviews.llvm.org/D70922

Files:
  llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
  llvm/test/CodeGen/ARM/GlobalISel/arm-legalize-consts.mir
  llvm/test/CodeGen/ARM/GlobalISel/arm-legalize-fp.mir
  llvm/test/CodeGen/Mips/GlobalISel/legalizer/constants.mir
  llvm/test/CodeGen/Mips/GlobalISel/legalizer/select.mir
  llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/constants.ll
  llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/fcmp.ll
  llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/select.ll
  llvm/test/CodeGen/X86/GlobalISel/ashr-scalar.ll
  llvm/test/CodeGen/X86/GlobalISel/legalize-constant.mir
  llvm/test/CodeGen/X86/GlobalISel/lshr-scalar.ll
  llvm/test/CodeGen/X86/GlobalISel/shl-scalar.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70922.231771.patch
Type: text/x-patch
Size: 11130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191202/a57c1306/attachment.bin>


More information about the llvm-commits mailing list