stability of llvm ir across releases

Is it safe to assume that LLVM IR will live more-or-less the same for most releases, and that significant changes will be communicated?

Or is it something that can change at any time and you must not rely on it ever being same.

To me, it seems like the IR has evolved slowly but no spectacularly large changes were made in the 1-1.5 years I’ve been watching it, – sure some experimental patch point, gc stuff, but not your day-to-day types etc

I’m asking because I’m going to take somewhat major dependencies in my upcoming system on the IR, and being able to store it across multiple releases of my system.

I don’t anticipate moving to newer versions of LLVM every time I release, but I do imagine wanting to upgrade to let’s say LLVM 3.7 or whatever releases come by.


Assembly syntax can and will break between versions. But bitcode should generally be upgradeable, or a bug should be filed.

Are you saying the textual form of IR can change, but bitcode doesn’t? I don’t know what you mean by assembly syntax.

Is there a changlog entry when the textual IR changes?

Usually but it has changed quite a bit lately. The suggestion is to avoid using textual IR except for debugging.

The general principle I’ve seen applied in mailing list discussions;
Textual IR could change significantly, the complexity of preserving backwards compatibility in the parser is often too high.

Binary IR, is a much more structured format, backwards compatibility is easier to support. IR Correctness should be preserved, but some language features might be ignored. eg old meta-data formats will be silently stripped out.

I concur with Jeremy - it is mostly ok to consume older IR with newer LLVM, but metadata has changed significantly in just about every release since 3.2 (one of the issues with OpenCL SPIR 1.2 using the 3.2 IR is that all people implementing OpenCL drivers that support SPIR have to have some funky code on the go to support the older IR).

I think it is wrong to assume the IR wouldn’t change though - one of the best things about LLVM is the utter disregard for backwards compatibility if it allows the project to do something in a better way - if that meant the IR had to be massively changed it would be done and the community wouldn’t even glance backwards :wink: