summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Zhogin <andrew.zhogin@gmail.com>2017-07-04 15:57:39 +0000
committerAndrew Zhogin <andrew.zhogin@gmail.com>2017-07-04 15:57:39 +0000
commitde5d250a0b1c23c1c7629d16c67010d80c6504f4 (patch)
treeee6f6e04ce92cc4496ede39ccc95b2f62e7c4489
parent5e4145898590d1f5af3f8312cb92697161f351b2 (diff)
downloadbcm5719-llvm-de5d250a0b1c23c1c7629d16c67010d80c6504f4.tar.gz
bcm5719-llvm-de5d250a0b1c23c1c7629d16c67010d80c6504f4.zip
[DAGCombiner] Intermediate variables in visitRotate promoted to the function's begin. NFC precommit for D12833.
llvm-svn: 307091
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 5c452f69b03..26164e6d907 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5268,13 +5268,16 @@ SDValue DAGCombiner::distributeTruncateThroughAnd(SDNode *N) {
}
SDValue DAGCombiner::visitRotate(SDNode *N) {
+ SDLoc dl(N);
+ SDValue N0 = N->getOperand(0);
+ SDValue N1 = N->getOperand(1);
+ EVT VT = N->getValueType(0);
+
// fold (rot* x, (trunc (and y, c))) -> (rot* x, (and (trunc y), (trunc c))).
- if (N->getOperand(1).getOpcode() == ISD::TRUNCATE &&
- N->getOperand(1).getOperand(0).getOpcode() == ISD::AND) {
- if (SDValue NewOp1 =
- distributeTruncateThroughAnd(N->getOperand(1).getNode()))
- return DAG.getNode(N->getOpcode(), SDLoc(N), N->getValueType(0),
- N->getOperand(0), NewOp1);
+ if (N1.getOpcode() == ISD::TRUNCATE &&
+ N1.getOperand(0).getOpcode() == ISD::AND) {
+ if (SDValue NewOp1 = distributeTruncateThroughAnd(N1.getNode()))
+ return DAG.getNode(N->getOpcode(), dl, VT, N0, NewOp1);
}
return SDValue();
}
OpenPOWER on IntegriCloud