From: David Blaikie Date: Wed, 9 Aug 2017 18:34:18 +0000 (+0000) Subject: Reduce variable scope by moving declaration into if clause X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e858424030e2afae78337327c7b4e242bba2ba4;p=llvm Reduce variable scope by moving declaration into if clause git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310506 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index e90db4803ee..c7da2460356 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -5104,17 +5104,17 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { // Static allocas are handled more efficiently in the variable frame index // side table. - const auto *AI = - dyn_cast(Address->stripInBoundsConstantOffsets()); - if (AI && AI->isStaticAlloca() && FuncInfo.StaticAllocaMap.count(AI)) - return nullptr; + if (const auto *AI = + dyn_cast(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(Address->stripInBoundsConstantOffsets()); - if (Arg && FuncInfo.getArgumentFrameIndex(Arg) != INT_MAX) - return nullptr; + if (const auto *Arg = + dyn_cast(Address->stripInBoundsConstantOffsets())) + if (FuncInfo.getArgumentFrameIndex(Arg) != INT_MAX) + return nullptr; SDValue &N = NodeMap[Address]; if (!N.getNode() && isa(Address))