Getting a strange LLVM issue


#1

Hey, I’m getting an interesting LLVM issue when compiling some code in release mode in ARMv7 (Raspberry Pi 3). The error I get is the following:

LLVM ERROR: ran out of registers during register allocation

When running in verbose mode, I get this explanation:

error: register allocation failed: maximum interference for recoloring reached. Use -fexhaustive-register-search to skip cutoffs

The command being executed in that moment is this:

process didn't exit successfully: `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/httparse-1.2.0/src/lib.rs --crate-name httparse --crate-type lib -C opt-level=3 -C panic=unwind --cfg feature="default" --cfg feature="std" -C metadata=6cef35a1a990b980 -C extra-filename=-6cef35a1a990b980 --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native` (exit code: 1)

In my .cargo/config file I have this:

[build]
rustflags = ["-C", "target-cpu=native"]

How do I fix it? where do I put that flag? and, what does it do?


#2

I believe this should work:

rustflags = [
    "-C", "target-cpu=native",
    "-C", "llvm-args=-fexhaustive-register-search"
]

#3

Well, that didn’t work, but I got a message saying that I might mean using -exhaustive-register-search, and I did, but I still receive these errors:

     Running `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-0.7.15/src/lib.rs --crate-name serde --crate-type lib -C opt-level=3 -C panic=unwind --cfg feature=\"default\" --cfg feature=\"std\" -C metadata=65008511a285da6a -C extra-filename=-65008511a285da6a --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native -C llvm-args=-exhaustive-register-search`
     Running `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/language-tags-0.2.2/src/lib.rs --crate-name language_tags --crate-type lib -C opt-level=3 -C panic=unwind -C metadata=1618bd815fd1995d -C extra-filename=-1618bd815fd1995d --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native -C llvm-args=-exhaustive-register-search`
     Running `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/httparse-1.2.0/src/lib.rs --crate-name httparse --crate-type lib -C opt-level=3 -C panic=unwind --cfg feature=\"default\" --cfg feature=\"std\" -C metadata=6cef35a1a990b980 -C extra-filename=-6cef35a1a990b980 --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native -C llvm-args=-exhaustive-register-search`
     Running `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/utf8-ranges-0.1.3/src/lib.rs --crate-name utf8_ranges --crate-type lib -C opt-level=3 -C panic=unwind -C metadata=283a6c72392caa0b -C extra-filename=-283a6c72392caa0b --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native -C llvm-args=-exhaustive-register-search`
LLVM ERROR: ran out of registers during register allocation
Build failed, waiting for other jobs to finish...
LLVM ERROR: ran out of registers during register allocation
Build failed, waiting for other jobs to finish...
error: Could not compile `httparse`.

Caused by:
  process didn't exit successfully: `rustc /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/httparse-1.2.0/src/lib.rs --crate-name httparse --crate-type lib -C opt-level=3 -C panic=unwind --cfg feature="default" --cfg feature="std" -C metadata=6cef35a1a990b980 -C extra-filename=-6cef35a1a990b980 --out-dir /home/pi/nicehash-test/target/release/deps --emit=dep-info,link -L dependency=/home/pi/nicehash-test/target/release/deps --cap-lints allow -C target-cpu=native -C llvm-args=-exhaustive-register-search` (exit code: 1)

Seems that the first error was fixed (it does not show anything about -fexhaustive-register-search) but I still get the LLVM error.


#4

What version is this? It could be a LLVM bug that got fixed.


#5

True, I was using the current beta:

rustc 1.13.0-beta.3 (106d18793 2016-11-04)
binary: rustc
commit-hash: 106d187933044f00a4ce995e3d47c13e9c206b0e
commit-date: 2016-11-04
host: armv7-unknown-linux-gnueabihf
release: 1.13.0-beta.3

But using nightly seems to work.


#6

I am facing the same issue with 1.13.0 release at armv7 hardware.


#7

Rust 1.13 has a bug in ARM. Use Rust ^1.14