[llvm-commits] [PATCH] Add an attribute for Oz related optimizations

Eli Friedman eli.friedman at gmail.com
Thu Oct 18 16:02:38 PDT 2012


On Thu, Oct 18, 2012 at 3:47 PM, Quentin Colombet <qcolombet at apple.com> wrote:
>
> On Oct 18, 2012, at 11:43 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
>
>> On Thu, Oct 18, 2012 at 11:36 AM, Quentin Colombet <qcolombet at apple.com> wrote:
>>>
>>> On Oct 18, 2012, at 11:25 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>>
>>>> On Thu, Oct 18, 2012 at 11:01 AM, Quentin Colombet <qcolombet at apple.com> wrote:
>>>>> Hi,
>>>>>
>>>>> The attached patch is the first step to have a better control on Oz related optimizations.
>>>>> The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
>>>>>
>>>>> The idea would be to set this attribute to all functions when the Oz optimization level is On (modification not available in this patch) and slowly tune the existing optimizations according to this attribute.
>>>>>
>>>>> This is my first patch to llvm, so do not hesitate to make comments please.
>>>>
>>>> What optimizations in particular are you planning on changing?
>>>
>>> Right now, I am thinking of target specific optimization.
>>> For instance, you can see this piece of code in lib/Target/ARM/Thumb2SizeReduction.cpp:
>>>  // FIXME: Disable check for -Oz (aka OptimizeForSizeHarder).
>>>  if (!STI->avoidCPSRPartialUpdate())
>>>    return false;
>>
>> Okay.
>>
>>
>> Please include a testcase in your patch to make sure we parse the
>> attribute correctly.
>
> Here is the new patch with the test case that checks that the attribute is parsed correctly.
> To make this possible I had to extend the mask used in the encoding/decoding of the bitcode in lib/VMCore/Attributes.cpp, lines 127 and 145.
> As far as I understood, this modification is ok as a record is a 64 bits value (only 44 bits were used and I added 4 of then).
> Am I right?

Yes, that's fine.


Your test doesn't actually check that the forcesizeopt attribute is
preserved; please just FileCheck the output of the first llvm-dis
invocation against the expected string.

-Eli



More information about the llvm-commits mailing list