summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-10-25 22:01:09 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-10-25 22:01:09 +0000
commitde86241a097414640d1d410e68ac3287c24d9810 (patch)
tree053bd989732327536bb72d99482d7940169c040c /llvm/lib
parent33308f92ebef0a0848997f912659c50ddf647383 (diff)
downloadbcm5719-llvm-de86241a097414640d1d410e68ac3287c24d9810.tar.gz
bcm5719-llvm-de86241a097414640d1d410e68ac3287c24d9810.zip
[DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1)) combine for splatted vectors
llvm-svn: 285129
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index f8953f0fb49..81fb69f517f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2482,9 +2482,9 @@ SDValue DAGCombiner::visitREM(SDNode *N) {
}
// fold (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1))
if (N1.getOpcode() == ISD::SHL) {
- ConstantSDNode *SHC = getAsNonOpaqueConstant(N1.getOperand(0));
- if (SHC && SHC->getAPIntValue().isPowerOf2()) {
- APInt NegOne = APInt::getAllOnesValue(VT.getSizeInBits());
+ ConstantSDNode *SHC = isConstOrConstSplat(N1.getOperand(0));
+ if (SHC && !SHC->isOpaque() && SHC->getAPIntValue().isPowerOf2()) {
+ APInt NegOne = APInt::getAllOnesValue(VT.getScalarSizeInBits());
SDValue Add =
DAG.getNode(ISD::ADD, DL, VT, N1, DAG.getConstant(NegOne, DL, VT));
AddToWorklist(Add.getNode());
OpenPOWER on IntegriCloud