[PATCH] D35381: [DAGCombiner] Recognise vector rotations with non-splat constants
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 15 13:23:28 PDT 2017
RKSimon added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4672
if (LHSMask.getNode()) {
- APInt RHSBits = APInt::getLowBitsSet(EltSizeInBits, LShVal);
+ SDValue RHSBits = buildLoHiRotateVecBitmask(RHSShiftAmt, true, DL, VT);
Mask = DAG.getNode(ISD::AND, DL, VT, Mask,
----------------
RKSimon wrote:
> This can be done with
> ```
> SDValue RHSBits = DAG.getNode(ISD::SRL, DL, VT, AllOnes, RHSShiftAmt);
> ```
> (Taking AllOnes from the value initially assigned to Mask).
Probably safer to use getNode instead of FoldConstantArithmetic, same for below
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4591
+// if Left + Right == Sum (constant or constant splat vector)
+bool DAGCombiner::sumMatchConstant(SDValue Left, SDValue Right, unsigned Sum,
+ const SDLoc &DL) {
----------------
There's no need for this to be part of DAGCombiner - just make it static and pass SelectionDAG& as an argument
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4655
if (LHSMask.getNode() || RHSMask.getNode()) {
- SDValue Mask = DAG.getAllOnesConstant(DL, VT);
+ SDValue One = DAG.getAllOnesConstant(DL, VT);
+ SDValue Mask = One;
----------------
Probably better to call this AllOnes not One
https://reviews.llvm.org/D35381
More information about the llvm-commits
mailing list