[PATCH] D45806: DAGcombiner: Handle correctly non-splat power of 2 -1 divisor
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 03:59:53 PDT 2018
RKSimon marked an inline comment as done.
RKSimon added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3104
Res);
+ // Special Case: (sdiv X, -1) -> 0-X
+ SDValue AllOnes = DAG.getAllOnesConstant(DL, VT);
----------------
efriedma wrote:
> Instead of separate special cases for 1 and -1, could you move the special case for 1 before the result is negated? Would probably result in a little less code for vectors like <1, -1, 2, -2>
I'll look at this next
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3108
+ DAG.getNode(ISD::SUB, DL, VT, Zero, N0), Res);
+ // TODO Special Case: (sdiv X, MIN_SIGNED) -> SELECT(X == MIN_SIGNED, 1, 0)
return Res;
----------------
efriedma wrote:
> I'm not sure you actually need a special case for MIN_SIGNED; I think r335720 solved the issue.
I think you're right - I'll leave the IsPowerOfTwo early out in for now but won't need to add a special case selection.
Repository:
rL LLVM
https://reviews.llvm.org/D45806
More information about the llvm-commits
mailing list