esp-rs / rust

Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
https://www.rust-lang.org
Other
743 stars 39 forks source link

LLVM ERROR: Error while trying to spill A9 from class AR #87

Closed andresv closed 2 years ago

andresv commented 3 years ago

Got this error while building num-rational.

warning: Patch `getrandom v0.1.16 (https://github.com/ivmarkov/getrandom.git?branch=0.1#d942e06a)` was not used in the crate graph.
Patch `polling v2.1.0 (https://github.com/ivmarkov/polling#260dded7)` was not used in the crate graph.
Patch `socket2 v0.4.2 (https://github.com/ivmarkov/socket2#7217ebe8)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
    Blocking waiting for file lock on build directory
   Compiling num-rational v0.3.2
   Compiling atat v0.13.1
   Compiling esp-idf-hal v0.21.0
   Compiling num v0.3.1
   Compiling embedded-time v0.11.0
   Compiling esp-idf-svc v0.26.0
LLVM ERROR: Error while trying to spill A9 from class AR: Cannot scavenge register without an emergency spill slot!
error: could not compile `num-rational`
MabezDev commented 3 years ago

Thanks for the report! We've been seeing this periodically for a while, I'd really like to nail this thing.

Do you think you could supply the llvm-ir for building num-rational? Prepending RUSTFLAGS='--emit=llvm-ir' should be enough.

MabezDev commented 3 years ago

Also a couple more details if you don't mind:

Thank you!

andresv commented 3 years ago

Minimum reproducible code: https://github.com/andresv/rust-esp32-std-mini/tree/create-llvm-error

LLVM ERROR: Cannot select: 0x7fb37f9d65a0: f32,f32 = fsincos 0x7fb37f9d8468, /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/f32.rs:563:18 @[ /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-graphics-0.7.1/src/geometry/angle.rs:128:9 @[ /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-graphics-0.7.1/src/primitives/common/linear_equation.rs:83:27 ] ]
  0x7fb37f9d8468: f32,ch = CopyFromReg 0x7fb36d4eafd8, Register:f32 %7, /Users/andres/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/f32.rs:563:18 @[ /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-graphics-0.7.1/src/geometry/angle.rs:128:9 @[ /Users/andres/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-graphics-0.7.1/src/primitives/common/linear_equation.rs:83:27 ] ]
    0x7fb3dd886f68: f32 = Register %7
In function: _ZN17embedded_graphics10primitives6common15linear_equation20OriginLinearEquation10with_angle17h86e4498f469fd620E
error: could not compile `embedded-graphics`
warning: build failed, waiting for other jobs to finish...
LLVM ERROR: Error while trying to spill A2 from class AR: Cannot scavenge register without an emergency spill slot!
MabezDev commented 3 years ago

Thanks @andresv!

FYI that first error can be fixed by upgrading to 1.56 release.

andresv commented 3 years ago

Indeed first one is fixed by 1.56. Do you have a hunch the for second one. I try to currently strip down one of the libs to bare minimum hoping that this magically goes away.

andresv commented 2 years ago

FYI: tried with 1.57 and LLVM13 and got the same error.

MabezDev commented 2 years ago

This should now be fixed as of the 1.60.0.1 release of our fork. Thanks for the report and the helpful test case!