[llvm] r310506 - Reduce variable scope by moving declaration into if clause

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 11:34:18 PDT 2017


Author: dblaikie
Date: Wed Aug  9 11:34:18 2017
New Revision: 310506

URL: http://llvm.org/viewvc/llvm-project?rev=310506&view=rev
Log:
Reduce variable scope by moving declaration into if clause

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=310506&r1=310505&r2=310506&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug  9 11:34:18 2017
@@ -5104,17 +5104,17 @@ SelectionDAGBuilder::visitIntrinsicCall(
 
     // Static allocas are handled more efficiently in the variable frame index
     // side table.
-    const auto *AI =
-        dyn_cast<AllocaInst>(Address->stripInBoundsConstantOffsets());
-    if (AI && AI->isStaticAlloca() && FuncInfo.StaticAllocaMap.count(AI))
-      return nullptr;
+    if (const auto *AI =
+            dyn_cast<AllocaInst>(Address->stripInBoundsConstantOffsets()))
+      if (AI->isStaticAlloca() && FuncInfo.StaticAllocaMap.count(AI))
+        return nullptr;
 
     // Byval arguments with frame indices were already handled after argument
     // lowering and before isel.
-    const auto *Arg =
-        dyn_cast<Argument>(Address->stripInBoundsConstantOffsets());
-    if (Arg && FuncInfo.getArgumentFrameIndex(Arg) != INT_MAX)
-      return nullptr;
+    if (const auto *Arg =
+            dyn_cast<Argument>(Address->stripInBoundsConstantOffsets()))
+      if (FuncInfo.getArgumentFrameIndex(Arg) != INT_MAX)
+        return nullptr;
 
     SDValue &N = NodeMap[Address];
     if (!N.getNode() && isa<Argument>(Address))




More information about the llvm-commits mailing list