[llvm] r205437 - [C++11, ARM64] Range based for loops in address type promotion.

Jim Grosbach grosbach at apple.com
Wed Apr 2 11:36:19 PDT 2014


On Apr 2, 2014, at 11:25 AM, Owen Anderson <resistor at mac.com> wrote:

> 
> On Apr 2, 2014, at 11:18 AM, Tim Northover <t.p.northover at gmail.com> wrote:
> 
>> Hi Jim,
>> 
>>> +    for (auto Inst : Insts) {
>> 
>> Not really a comment on this patch specifically, but how we do C++11
>> in general. When I saw this I was worried that you'd just created a
>> copy of a MachineInstr and should have taken it by reference.
>> 
>> Might it be better to use the actual type if the for header will still
>> fit on one line?
> 
> +1.  After range-ifying a lot of loops in the backend, I’ve found that it’s often better to write out the type as long as it’s not something hideously complicated.  I’ve had lots of cases where I did double-takes on code I wrote when I wasn’t certain if it was making a copy of a MachineInstr or something.

(consolidating replies to Tim, Dave and Owen)

Yep, that’s an entirely fair point. I’ll twiddle things around to be a bit more obvious. Thanks, all!



More information about the llvm-commits mailing list