[llvm-commits] [llvm] r171471 - /llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp

Shuxin Yang shuxin.llvm at gmail.com
Fri Jan 4 15:03:26 PST 2013


I spot a defect that contribute the code size problem. I don't know to 
what ext it impacts the code sz.
However, it is certainly easy to fix.

The problem is that if a scalar constant, say s=2.0f,  is broadcasted 
into a vector v=<2.0, 2.0, 2.0, 2.0>,  and
if the scalar is still referenced in the code, we will see the compiler 
creates read-only storage both for s and v.
Actually the storage for the scalar is not necessary.

On 1/4/13 10:09 AM, Nadav Rotem wrote:
> Hi Hal,
>
> I spoke with chandler last night and he said that he ran comprehensive testing and he found two interesting things:
>
> 1. When vectorizing everything with O2, the code gets 3% bigger, and as a result slower.  When it works it works really well, but most vectorizable loops are in the cold path.
> 2. When disabling the pre-loop for loops that require: runtime checks, odd number of iterations, etc. Then the loop vectorizer does not catch much.
>
> At the moment it looks like it is better to mimic the gcc behavior and enable the loop vectorizer only on O3.
>
> Nadav
>
>
> On Jan 4, 2013, at 10:04 AM, Hal Finkel <hfinkel at anl.gov> wrote:
>
>> ----- Original Message -----
>>> From: "Nadav Rotem" <nrotem at apple.com>
>>> To: llvm-commits at cs.uiuc.edu
>>> Sent: Friday, January 4, 2013 11:57:44 AM
>>> Subject: [llvm-commits] [llvm] r171471 -	/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
>>>
>>> Author: nadav
>>> Date: Fri Jan  4 11:57:44 2013
>>> New Revision: 171471
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=171471&view=rev
>>> Log:
>>> Move the loop vectorizer from O2 to O3. It looks like the increase in
>>> code size actually hurts the performance on many programs.
>> Can you be specific about what code size increase? (runtime checks, if conversion, unrolling)? And what does this have to do with moving the vectorizer from -02 to -O3? To be clear, I don't object to the change (enabling autovectorization at -O3 seems pretty standard these days).
>>
>> Thanks again,
>> Hal
>>
>>> Modified:
>>>     llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
>>>
>>> Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=171471&r1=171470&r2=171471&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
>>> +++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Fri Jan  4
>>> 11:57:44 2013
>>> @@ -187,7 +187,7 @@
>>>    MPM.add(createLoopIdiomPass());             // Recognize idioms
>>>    like memset.
>>>    MPM.add(createLoopDeletionPass());          // Delete dead loops
>>>
>>> -  if (LoopVectorize && OptLevel > 1)
>>> +  if (LoopVectorize && OptLevel > 2)
>>>      MPM.add(createLoopVectorizePass());
>>>
>>>    if (!DisableUnrollLoops)
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>> -- 
>> Hal Finkel
>> Postdoctoral Appointee
>> Leadership Computing Facility
>> Argonne National Laboratory
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list