[polly] r258660 - BlockGenerators: Avoid redundant map lookup [NFC]

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 11:52:37 PST 2016


On Sun, Jan 24, 2016 at 6:17 AM, Tobias Grosser via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: grosser
> Date: Sun Jan 24 08:16:59 2016
> New Revision: 258660
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258660&view=rev
> Log:
> BlockGenerators: Avoid redundant map lookup [NFC]
>
> Modified:
>     polly/trunk/lib/CodeGen/BlockGenerators.cpp
>
> Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=258660&r1=258659&r2=258660&view=diff
>
> ==============================================================================
> --- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
> +++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sun Jan 24 08:16:59 2016
> @@ -338,8 +338,8 @@ Value *BlockGenerator::getOrCreateAlloca
>
>    auto Addr = Map[ScalarBase];
>
> -  if (GlobalMap.count(Addr))
> -    return GlobalMap[Addr];
> +  if (auto NewAddr = GlobalMap.lookup(Addr))
>

Probably best to include the '*' in auto here (if I'm understanding the
code correctly, auto is binding to Instruction* here) to make it clear that
it's a pointer (& that this if test is a null pointer test)?


> +    return NewAddr;
>
>    return Addr;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160125/886125d2/attachment.html>


More information about the llvm-commits mailing list