[llvm] r307091 - [DAGCombiner] Intermediate variables in visitRotate promoted to the function's begin. NFC precommit for D12833.

Andrew Zhogin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 4 08:57:39 PDT 2017


Author: andrew.zhogin
Date: Tue Jul  4 08:57:39 2017
New Revision: 307091

URL: http://llvm.org/viewvc/llvm-project?rev=307091&view=rev
Log:
[DAGCombiner] Intermediate variables in visitRotate promoted to the function's begin. NFC precommit for D12833.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=307091&r1=307090&r2=307091&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Jul  4 08:57:39 2017
@@ -5268,13 +5268,16 @@ SDValue DAGCombiner::distributeTruncateT
 }
 
 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();
 }




More information about the llvm-commits mailing list