[llvm-commits] [llvm] r156387 - /llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp

Stephen Hines srhines at google.com
Tue May 29 16:59:58 PDT 2012


I wasn't sure what LLVM 3.0/3.1 emitted in this case, but figured that we
should err on the side of caution. LLVM 3.0 accepted bitcode with these
attributes, so it makes sense that LLVM 3.2 should still accept similar
bitcode.

Steve

On Tue, May 29, 2012 at 4:41 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote:

> Why?
> Does LLVM 3.0 or 3.1 still emit the attributes in index 0?  The conclusion
> of the previous thread was that we only need to maintain compatibility from
> 3.0 onwards.
>
> Nuno
>
>
> Citando Stephen Hines <srhines at google.com>:
>
>
>  Hi Nuno,
>>
>> Would you please revert this change as well?
>>
>> Thanks,
>> Steve
>>
>> On Tue, May 8, 2012 at 10:07 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>>
>>  Author: nlopes
>>> Date: Tue May  8 12:07:35 2012
>>> New Revision: 156387
>>>
>>> URL: http://llvm.org/viewvc/llvm-**project?rev=156387&view=rev<http://llvm.org/viewvc/llvm-project?rev=156387&view=rev>
>>> Log:
>>> remove autoupgrade code for old function attributes format.
>>> I still left another fixme regarding alignment, because I'm unsure how to
>>> remove that code without breaking things
>>>
>>> Modified:
>>>   llvm/trunk/lib/Bitcode/Reader/**BitcodeReader.cpp
>>>
>>> Modified: llvm/trunk/lib/Bitcode/Reader/**BitcodeReader.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-**project/llvm/trunk/lib/**
>>> Bitcode/Reader/BitcodeReader.**cpp?rev=156387&r1=156386&r2=**
>>> 156387&view=diff<http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=156387&r1=156386&r2=156387&view=diff>
>>>
>>> ==============================**==============================**
>>> ==================
>>> --- llvm/trunk/lib/Bitcode/Reader/**BitcodeReader.cpp (original)
>>> +++ llvm/trunk/lib/Bitcode/Reader/**BitcodeReader.cpp Tue May  8
>>> 12:07:35
>>> 2012
>>> @@ -458,12 +458,6 @@
>>>      if (Record.size() & 1)
>>>        return Error("Invalid ENTRY record");
>>>
>>> -      // FIXME : Remove this autoupgrade code in LLVM 3.0.
>>> -      // If Function attributes are using index 0 then transfer them
>>> -      // to index ~0. Index 0 is used for return value attributes but
>>> used to be
>>> -      // used for function attributes.
>>> -      Attributes RetAttribute;
>>> -      Attributes FnAttribute;
>>>      for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
>>>        // FIXME: remove in LLVM 3.0
>>>        // The alignment is stored as a 16-bit raw value from bits 31--16.
>>> @@ -480,34 +474,10 @@
>>>            Attributes((Record[i+1] & (0xffffull << 32)) >> 11);
>>>
>>>        Record[i+1] = ReconstitutedAttr.Raw();
>>> -        if (Record[i] == 0)
>>> -          RetAttribute = ReconstitutedAttr;
>>> -        else if (Record[i] == ~0U)
>>> -          FnAttribute = ReconstitutedAttr;
>>> -      }
>>> -
>>> -      Attributes OldRetAttrs = (Attribute::NoUnwind|**
>>> Attribute::NoReturn|
>>> -                              Attribute::ReadOnly|Attribute:**
>>> :ReadNone);
>>> -
>>> -      if (FnAttribute == Attribute::None && RetAttribute !=
>>> Attribute::None &&
>>> -          (RetAttribute & OldRetAttrs)) {
>>> -        if (FnAttribute == Attribute::None) { // add a slot so they get
>>> added.
>>> -          Record.push_back(~0U);
>>> -          Record.push_back(0);
>>> -        }
>>> -
>>> -        FnAttribute  |= RetAttribute & OldRetAttrs;
>>> -        RetAttribute &= ~OldRetAttrs;
>>>      }
>>>
>>>      for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
>>> -        if (Record[i] == 0) {
>>> -          if (RetAttribute != Attribute::None)
>>> -            Attrs.push_back(**AttributeWithIndex::get(0,
>>> RetAttribute));
>>> -        } else if (Record[i] == ~0U) {
>>> -          if (FnAttribute != Attribute::None)
>>> -            Attrs.push_back(**AttributeWithIndex::get(~0U,
>>> FnAttribute));
>>> -        } else if (Attributes(Record[i+1]) != Attribute::None)
>>> +        if (Attributes(Record[i+1]) != Attribute::None)
>>>          Attrs.push_back(**AttributeWithIndex::get(**Record[i],
>>>
>>> Attributes(Record[i+1])));
>>>      }
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120529/b67ec6e2/attachment.html>


More information about the llvm-commits mailing list