[PATCH] CodeGenPrep: rewrite a few loops in C++11 style

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Jan 7 14:48:22 PST 2015


> On 2015-Jan-07, at 14:41, Ramkumar Ramachandra <artagnon at gmail.com> wrote:
> 
> It depends on what you want to construct from the iteration. You could construct a BasicBlock, like you said; but this is perfectly valid too: you can try it out, and see that tests pass.
> 

This works because of an implementation quirk of `ilist_iterator`,
which can be constructed from a reference of the node type.

While technically valid, this code is misleading, and I don't know
that we want to propagate dependencies on that conversion.  I think
this should instead be, e.g.:

    for (BasicBlock &BB : F)
      EverMadeChange |= bypassSlowDivision(F, &BB, BypassWidths);

Thoughts from anyone else?



More information about the llvm-commits mailing list