diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-04-24 21:43:21 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-04-24 21:43:21 +0000 |
commit | 93da6660a26dd74d7d7881ad7b2daa7ac2b41bb1 (patch) | |
tree | e6276cd1b6426f5ba9a77b4431324256442a2a53 /llvm/lib/CodeGen | |
parent | 0b11403d55ce34447efcb9a163df8c896fa31ced (diff) | |
download | bcm5719-llvm-93da6660a26dd74d7d7881ad7b2daa7ac2b41bb1.tar.gz bcm5719-llvm-93da6660a26dd74d7d7881ad7b2daa7ac2b41bb1.zip |
[DAGCombiner] Use APInt::intersects to avoid tmp variable. NFCI.
llvm-svn: 301258
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 9251bf9f04d..aeca3c2aa2b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4200,12 +4200,13 @@ SDValue DAGCombiner::visitOR(SDNode *N) { // reassociate or if (SDValue ROR = ReassociateOps(ISD::OR, SDLoc(N), N0, N1)) return ROR; + // Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2) // iff (c1 & c2) != 0. if (N1C && N0.getOpcode() == ISD::AND && N0.getNode()->hasOneUse() && isa<ConstantSDNode>(N0.getOperand(1))) { ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1)); - if ((C1->getAPIntValue() & N1C->getAPIntValue()) != 0) { + if (C1->getAPIntValue().intersects(N1C->getAPIntValue())) { if (SDValue COR = DAG.FoldConstantArithmetic(ISD::OR, SDLoc(N1), VT, N1C, C1)) return DAG.getNode( @@ -4214,6 +4215,7 @@ SDValue DAGCombiner::visitOR(SDNode *N) { return SDValue(); } } + // Simplify: (or (op x...), (op y...)) -> (op (or x, y)) if (N0.getOpcode() == N1.getOpcode()) if (SDValue Tmp = SimplifyBinOpWithSameOpcodeHands(N)) |