[LLVMdev] Does LLVM 3.5 works with IR from LLVM 3.0?

Renato Golin renato.golin at linaro.org
Tue Jul 15 16:39:04 PDT 2014


On 15 July 2014 22:00, Gaoyao Xiao <windxing2007 at gmail.com> wrote:
>> llvm-dis-3.0 -f -o - file.bc | llvm-as-3.5 -f -o newfile.bc
>
> I tried this and the newfile.bc is incorrect. newfile.bc can be compiled to
> binary but cannot run.

This may not be perfect, but it is expected. The only guarantees of
compatibility between front-end and back-ends (linked by IR) is that
release X tools will work with release X back-ends, and that trunk
tools will work with trunk back-ends. Everything else is unknown,
unspecified and untested.

There hasn't been, to my knowledge, any effort into standardizing LLVM
IR into a language per se, which could be implemented like C or Dwarf,
by having standard levels based on release year or major/minor
revisions. We do have the LangRef document for every major release,
but the IR libraries did not require backwards compatibility, so
support was never done to match.

Supporting legacy IR is not as simple as it sounds, because ABI
decisions are taken every day to better implement the standards and
the targets in which we run, and interpreting different patterns as
similar concepts (or vice versa) would be a huge addendum to the
current code that deals with it. In summary, I don't think we'd ever
have that as a language.

As has been said many times before, but it's always good to repeat:
LLVM IR is a compiler IR. [1]

cheers,
--renato

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-October/043719.html



More information about the llvm-dev mailing list