diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-12-22 17:10:31 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-12-22 17:10:31 +0000 |
commit | 4b537aaf6deb42260a1fc11980a73bdeda853fb4 (patch) | |
tree | 69a572775e8a51ad95f5ce0896f73349645cee63 /llvm/lib/CodeGen | |
parent | 52c02d70e276aa1e138b9f43988de60838aacb8c (diff) | |
download | bcm5719-llvm-4b537aaf6deb42260a1fc11980a73bdeda853fb4.tar.gz bcm5719-llvm-4b537aaf6deb42260a1fc11980a73bdeda853fb4.zip |
[DAGCombiner] allow narrowing of add followed by truncate
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.
This gets us closer to deleting the x86 custom function (combineTruncatedArithmetic)
that does almost the same thing.
Differential Revision: https://reviews.llvm.org/D55866
llvm-svn: 350006
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a68980a9626..81bb73bf28e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -9825,8 +9825,7 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) { // because targets may prefer a wider type during later combines and invert // this transform. switch (N0.getOpcode()) { - // TODO: Add case for ADD - that will likely require a change in logic here - // or target-specific changes to avoid regressions. + case ISD::ADD: case ISD::SUB: case ISD::MUL: case ISD::AND: |