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

Owen Anderson resistor at mac.com
Wed Apr 2 11:25:43 PDT 2014


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.

—Owen



More information about the llvm-commits mailing list