[llvm] r368905 - [SDAG] move variable closer to use; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 12:46:15 PDT 2019


Author: spatel
Date: Wed Aug 14 12:46:15 2019
New Revision: 368905

URL: http://llvm.org/viewvc/llvm-project?rev=368905&view=rev
Log:
[SDAG] move variable closer to use; NFC

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=368905&r1=368904&r2=368905&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 14 12:46:15 2019
@@ -9003,7 +9003,6 @@ SelectionDAG::matchBinOpReduction(SDNode
     return SDValue();
 
   SDValue Op = Extract->getOperand(0);
-  unsigned Stages = Log2_32(Op.getValueType().getVectorNumElements());
 
   // Match against one of the candidate binary ops.
   if (llvm::none_of(CandidateBinOps, [Op](ISD::NodeType BinOp) {
@@ -9041,6 +9040,7 @@ SelectionDAG::matchBinOpReduction(SDNode
   // While a partial reduction match would be:
   // <2,3,u,u,u,u,u,u>
   // <1,u,u,u,u,u,u,u>
+  unsigned Stages = Log2_32(Op.getValueType().getVectorNumElements());
   SDValue PrevOp;
   for (unsigned i = 0; i < Stages; ++i) {
     unsigned MaskEnd = (1 << i);




More information about the llvm-commits mailing list