[PATCH] D23007: [DAGCombiner] Better support for shifting large value type by constants

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 03:12:30 PDT 2016


RKSimon created this revision.
RKSimon added reviewers: eli.friedman, majnemer, bryant, spatel, andreadb.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

As detailed on D22726, much of the shift combining code assume constant values will fit into a uint64_t value and calls ConstantSDNode::getZExtValue where it probably shouldn't (leading to asserts). Using APInt directly avoids this problem but we encounter other assertions if we attempt to compare/operate on 2 APInt of different bitwidths.

This patch adds a helper function to ensure that 2 APInt values are zero extended as required so that they can be safely used together. I've only added an initial example use for this to the '(SHIFT (SHIFT x, c1), c2) --> (SHIFT x, (ADD c1, c2))' combines. Further cases can easily be added as required.

Repository:
  rL LLVM

https://reviews.llvm.org/D23007

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/shift-i128.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23007.66293.patch
Type: text/x-patch
Size: 4091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160801/2a771dd2/attachment.bin>


More information about the llvm-commits mailing list