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.<div>
<br></div><div>Steve<br><br><div class="gmail_quote">On Tue, May 29, 2012 at 4:41 PM, Nuno Lopes <span dir="ltr"><<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Why?<br>
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.<br>
<br>
Nuno<br>
<br>
<br>
Citando Stephen Hines <<a href="mailto:srhines@google.com" target="_blank">srhines@google.com</a>>:<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nuno,<br>
<br>
Would you please revert this change as well?<br>
<br>
Thanks,<br>
Steve<br>
<br>
On Tue, May 8, 2012 at 10:07 AM, Nuno Lopes <<a href="mailto:nunoplopes@sapo.pt" target="_blank">nunoplopes@sapo.pt</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: nlopes<br>
Date: Tue May  8 12:07:35 2012<br>
New Revision: 156387<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=156387&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=156387&view=rev</a><br>
Log:<br>
remove autoupgrade code for old function attributes format.<br>
I still left another fixme regarding alignment, because I'm unsure how to<br>
remove that code without breaking things<br>
<br>
Modified:<br>
   llvm/trunk/lib/Bitcode/Reader/<u></u>BitcodeReader.cpp<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Reader/<u></u>BitcodeReader.cpp<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=156387&r1=156386&r2=156387&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>Bitcode/Reader/BitcodeReader.<u></u>cpp?rev=156387&r1=156386&r2=<u></u>156387&view=diff</a><br>

<br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/Bitcode/Reader/<u></u>BitcodeReader.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Reader/<u></u>BitcodeReader.cpp Tue May  8 12:07:35<br>
2012<br>
@@ -458,12 +458,6 @@<br>
      if (Record.size() & 1)<br>
        return Error("Invalid ENTRY record");<br>
<br>
-      // FIXME : Remove this autoupgrade code in LLVM 3.0.<br>
-      // If Function attributes are using index 0 then transfer them<br>
-      // to index ~0. Index 0 is used for return value attributes but<br>
used to be<br>
-      // used for function attributes.<br>
-      Attributes RetAttribute;<br>
-      Attributes FnAttribute;<br>
      for (unsigned i = 0, e = Record.size(); i != e; i += 2) {<br>
        // FIXME: remove in LLVM 3.0<br>
        // The alignment is stored as a 16-bit raw value from bits 31--16.<br>
@@ -480,34 +474,10 @@<br>
            Attributes((Record[i+1] & (0xffffull << 32)) >> 11);<br>
<br>
        Record[i+1] = ReconstitutedAttr.Raw();<br>
-        if (Record[i] == 0)<br>
-          RetAttribute = ReconstitutedAttr;<br>
-        else if (Record[i] == ~0U)<br>
-          FnAttribute = ReconstitutedAttr;<br>
-      }<br>
-<br>
-      Attributes OldRetAttrs = (Attribute::NoUnwind|<u></u>Attribute::NoReturn|<br>
-                              Attribute::ReadOnly|Attribute:<u></u>:ReadNone);<br>
-<br>
-      if (FnAttribute == Attribute::None && RetAttribute !=<br>
Attribute::None &&<br>
-          (RetAttribute & OldRetAttrs)) {<br>
-        if (FnAttribute == Attribute::None) { // add a slot so they get<br>
added.<br>
-          Record.push_back(~0U);<br>
-          Record.push_back(0);<br>
-        }<br>
-<br>
-        FnAttribute  |= RetAttribute & OldRetAttrs;<br>
-        RetAttribute &= ~OldRetAttrs;<br>
      }<br>
<br>
      for (unsigned i = 0, e = Record.size(); i != e; i += 2) {<br>
-        if (Record[i] == 0) {<br>
-          if (RetAttribute != Attribute::None)<br>
-            Attrs.push_back(<u></u>AttributeWithIndex::get(0, RetAttribute));<br>
-        } else if (Record[i] == ~0U) {<br>
-          if (FnAttribute != Attribute::None)<br>
-            Attrs.push_back(<u></u>AttributeWithIndex::get(~0U, FnAttribute));<br>
-        } else if (Attributes(Record[i+1]) != Attribute::None)<br>
+        if (Attributes(Record[i+1]) != Attribute::None)<br>
          Attrs.push_back(<u></u>AttributeWithIndex::get(<u></u>Record[i],<br>
<br>
Attributes(Record[i+1])));<br>
      }<br>
<br>
</blockquote></blockquote>
</div></div></blockquote></div><br></div>