[PATCH] D55866: [DAGCombiner] allow narrowing of add followed by truncate

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 16:38:08 PST 2018


spatel created this revision.
spatel added reviewers: arsenm, kparzysz, craig.topper, RKSimon.
Herald added subscribers: javed.absar, nhaehnle, wdng, jvesely, mcrosier.

trunc (add X, C ) --> add (trunc  X), C'

If we're throwing away the top bits of an 'add' instruction, do it in the narrow destination type.
This makes the truncate-able opcode list identical to the sibling transform done in IR (in instcombine).

This change used to show regressions for x86, but those are gone after D55494 <https://reviews.llvm.org/D55494>. This gets us closer to deleting the x86 custom function (combineTruncatedArithmetic) that does almost the same thing.


https://reviews.llvm.org/D55866

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AMDGPU/imm16.ll
  test/CodeGen/AMDGPU/trunc-combine.ll
  test/CodeGen/Hexagon/vect/vect-vaslw.ll
  test/CodeGen/X86/load-combine.ll
  test/CodeGen/X86/pr32329.ll
  test/CodeGen/X86/pr32345.ll
  test/CodeGen/X86/pr33290.ll
  test/CodeGen/X86/pr34381.ll
  test/CodeGen/X86/pr35765.ll
  test/CodeGen/X86/scheduler-backtracking.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55866.178804.patch
Type: text/x-patch
Size: 12277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181219/7403ebe9/attachment.bin>


More information about the llvm-commits mailing list