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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 13:05:14 PST 2016


On Mon, Jan 25, 2016 at 12:01 PM, Tobias Grosser <tobias at grosser.es> wrote:

> On 01/25/2016 08:52 PM, David Blaikie wrote:
>
>>
>>
>> On Sun, Jan 24, 2016 at 6:17 AM, Tobias Grosser via llvm-commits
>> <llvm-commits at lists.llvm.org <mailto: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)?
>>
>
> Thanks David, this is an AssertingVH, not a plain pointer.


Ah, right, I see now.


> Hence, it is
> is not possible to write it this way. However, the conversion to null
> still seems to work as expected. I have no idea how to write it better.
> Any suggestions?
>

Nothing great that comes to mind - could write out the type rather than
auto, but I doubt that'd add much. No worries

- Dave


>
> Best,
> Tobias
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160125/1b84fade/attachment.html>


More information about the llvm-commits mailing list