<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 4, 2021, at 00:07, Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" class="">andrew.kaylor@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Hi everyone,<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">I’ve recently discovered a problem with reading LLVM bitcode that was produced by older versions of LLVM. Specifically, if the older bitcode file contains calls to llvm.var.annotations or llvm.ptr.annotations, I get an error because the number of arguments to these intrinsics was changed. I’ve filed a bug for this (<a href="https://bugs.llvm.org/show_bug.cgi?id=49006" style="color: rgb(5, 99, 193); text-decoration: underline;" class="">https://bugs.llvm.org/show_bug.cgi?id=49006</a>) and I’m working on a patch to auto-upgrade the older IR.<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></blockquote><div><br class=""></div>That sounds good.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The extra argument was introduced in this patch:<span class="Apple-converted-space"> </span><a href="https://reviews.llvm.org/D88645" style="color: rgb(5, 99, 193); text-decoration: underline;" class="">https://reviews.llvm.org/D88645</a><o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">In looking closer at that patch, I see that an extra member was also added to the initializer structures for the llvm.global.annotations value. Here I have a problem that I’m not entirely sure how to handle. Specifically, the Annotation2Metadata pass, which was introduced here (<a href="https://reviews.llvm.org/D91195" style="color: rgb(5, 99, 193); text-decoration: underline;" class="">https://reviews.llvm.org/D91195</a>) expects the llvm.global.annotations values to have four members, but after the patch above clang creates initializers with five members.<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The top-of-trunk LLVM code will happily read a module containing four member initializers, and having read that module the Annotation2Metadata pass will create annotation metadata for it. Unfortunately, it appears that Annotation2Metadata will not create annotation metadata for the llvm.global.annotations with five-member initializers that are generated by the latest version of clang. So, I don’t know what the correct behavior here is.<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Should the BitcodeReader auto-upgrade the four-member initializers to five-member initializers with a null pointer in the fifth field? Or should Annotation2Metadata handle either type of initializer?<o:p class=""></o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div></div></blockquote></div><br class=""><div class="">Given that the pass was only added quite recently, I think just updating it to support the 5 field version would be fine, if we can pick it on the 12.x release branch.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Florian</div></body></html>