[llvm-dev] The state of ARMConstantIslandPass in 4.0.[01]

Ariel Ben-Yehuda via llvm-dev llvm-dev at lists.llvm.org
Mon May 29 14:41:08 PDT 2017


Hi,

We at Rust are using LLVM for our codegen. Since Rust version 1.19.0,
which should ship in July 21st, we are using a slightly patched
version of LLVM 4.0.

The transition to LLVM 4.0 had been fairly pain-free on x86 (at least
excluding the standard suite of assertion failures using MSVC SEH, but
that's fairly under control), but we have encountered several scary
bugs in ARM, most specifically in ARMConstantIslandPass.cpp:

 - https://github.com/rust-lang/rust/issues/41672
 - https://github.com/rust-lang/rust/issues/42248

The former of these is a fairly benign assertion failure, but the
latter is a scary "in the wild" wrong codegen bug, which can really
mess up with programmers.

Both of the bugs have fixes in trunk:
r295964 - Fix assertion failure in ARMConstantIslandPass.
r297871 - ARM: avoid clobbering register in v6 jump-table expansion.

I can easily backport the fixes for these 2 bugs into our LLVM branch.
However, while looking at the diff between 4.0 and trunk I've seen
several more fixes to "scary-looking" bugs:

r294949 - [Thumb-1] TBB generation: spot redefinitions of index register
r295816 - [ARM] Fix constant islands pass.
r299634 - [ARM] Remove a dead ADD during the creation of TBBs
    (that one looks more like an optimization than a wrong-codegen
thing, but including for completeness)
r300870 - [Thumb-1] Fix corner cases for compressed jump tables

After seeing the previous ones, I'm worried these other fixes might
also fix some "in the wild" wrong codegen bugs. However, I'm not
comfortable backporting so many patches by myself. We are open to
moving to being based on LLVM 4.0.1 when it is released, but it does
not seem to include *any* of the above fixes.

Are these fixes important? Should we backport them? Do we need to keep
anything in mind?

Thanks in advance,
    - Ariel


More information about the llvm-dev mailing list