[llvm-dev] Question about versioning of LVVM IR

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 26 20:53:41 PST 2017


> On Jan 26, 2017, at 1:56 AM, Stanislav Pankevich via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> It is likely that I missing something however I have to ask.
> 
> We are working on Mull project https://github.com/mull-project <https://github.com/mull-project> which deals with
> LLVM IR in the first place so it is often that we encounter errors like
> the following one when we do things like parseAssemblyString(IR, Err, GlobalCtx);`:
> 
> ```
> test: <string>:7237:187: error: invalid field 'variable'
> !1526 = distinct !DIGlobalVariable(name: "test_info_", linkageName: "_ZN14Hello_sup_Test10test_info_E", scope: !0, file: !1527, line: 4, type: !1528, isLocal: false, isDefinition: true, variable: %"class.testing::TestInfo"** @_ZN14Hello_sup_Test10test_info_E, declaration: !2817)
> ```
> 
> Quick research of recent LLVM commits reveals that stuff is being changed
> significantly, example:
> 
> commit 7b500b4bdf40cb40cb33bdcf5faf900db4930824
> Author: Adrian Prantl <aprantl at apple.com <mailto:aprantl at apple.com>>
> Date:   Tue Dec 20 02:09:43 2016 +0000
> 
>     [IR] Remove the DIExpression field from DIGlobalVariable.
> 
>     ...
> 
> The questions are:
> 
> 1) why do Asm / LL parsers not produce warnings like:
> 
> "LLVM IR you are using has version 3.9 which is incompatible with current
> supported version 4.0.ā€

Because the ASM is not portable from one version of LLVM to another. 
The bitcode is intended to be supported across version.

http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility


> 
> 2) I didn't find any special version markers in LLVM IR. My guess is that
> having them there would allow a developer who is changing LLVM IR format to
> put deprecation / backward incompatibility checks so that higher-level
> developers, like we are, see the friendly messages/warnings (see 1). It would
> help us a lot to see that the reason is incompatibility, not any other reasons
> like mistakes that we sometimes make.
> 
> Is there a reason why this kind of versioning is not being done in
> AsmParser/LLParser?
> 
> Is it hard to have such functionality in place?
> 
> Background: we develop `Mull` as in-source project inside LLVM. We often
> use stable LLVM distribution from `brew` and Rust stable/nightly compilers that are 
> often one version behind the latest stable version of LLVM. Currently our solution
> is to stick to stable version of LLVM source tree however having a more friendly
> output from AsmParser/LLParser would help us a lot to understand and debug
> things faster and easier.

Iā€™m not sure I understand exactly how you end up mix-and-matching versions of LLVM and assembly?

ā€” 
Mehdi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170126/bf145992/attachment.html>


More information about the llvm-dev mailing list