[llvm-commits] [llvm] r167785 - /llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp

Andrew Trick atrick at apple.com
Tue Nov 13 09:31:20 PST 2012


On Nov 13, 2012, at 5:42 AM, Dirk Steinke <steinke.dirk.ml at googlemail.com> wrote:

> Hi Andrew,
> 
> On 11/13/2012 12:59 AM, Andrew Trick wrote:
>> Author: atrick
>> Date: Mon Nov 12 17:59:48 2012
>> New Revision: 167785
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=167785&view=rev
>> Log:
>> Cleanup -join-splitedges. Make the loop more obvious.
>> 
>> Modified:
>>     llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
>> 
>> Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=167785&r1=167784&r2=167785&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Mon Nov 12 17:59:48 2012
>> @@ -234,11 +234,8 @@
>> 
>>    for (MachineBasicBlock::const_iterator MII = MBB->begin(), E = MBB->end();
>>         MII != E; ++MII) {
>> -    if (MII->isCopyLike())
>> -      continue;
>> -    if (MII->isUnconditionalBranch())
>> -      continue;
>> -    return false;
>> +    if (!MII->isCopyLike() || !MII->isUnconditionalBranch())
>> +      return false;
>>    }
>>    return true;
>>  }
> 
> Shouldn't this rather be
> +    if (!MII->isCopyLike() && !MII->isUnconditionalBranch())
> +      return false;
> ?

Absolutely. Even trivial cleanups should be tested :) I'm working on reducing unit tests.

-Andy



More information about the llvm-commits mailing list