Description
While compiling a large Rust binary on Windows I ran into an unusual LLVM error:
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h42691c75a9092543E"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %26, ptr noalias nocapture noundef nonnull dereferenceable(328) %10)
to label %32 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %47 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke void %95(ptr noundef align 1 %81, ptr noalias noundef nonnull readonly align 8 dereferenceable(128) %3)
to label %96 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h42691c75a9092543E"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %8)
to label %105 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h42691c75a9092543E"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %7)
to label %109 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h42691c75a9092543E"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %143, ptr noalias nocapture noundef nonnull dereferenceable(328) %5)
to label %149 unwind label %172
The unwind destination does not have an exception handling instruction!
%156 = invoke fastcc noundef zeroext i1 @_ZN13futures_timer6native5delay5Delay6_reset17h39450cb69010166bE(ptr noalias noundef nonnull align 8 dereferenceable(8) %151, i64 %153, i32 noundef %155)
to label %157 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %167 unwind label %172
CleanupPadInst not the first non-PHI instruction in the block.
%175 = cleanuppad within none []
in function _ZN94_$LT$libp2p_identify..handler..Handler$u20$as$u20$libp2p_swarm..handler..ConnectionHandler$GT$19on_connection_event17h5b45248c52481422E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `lighthouse`
error: failed to compile `lighthouse v3.4.0-tree.2 (C:\Users\Michael\code\lighthouse\lighthouse)`, intermediate artifacts can be found at `C:\Users\Michael\code\lighthouse\target`
I don't know how to produce a more minimal example. My experimenting so far has found that it only happens if all of these conditions are met:
- Compiling on Windows. Unaffected: Linux and macOS, as far as I can tell.
- Compiling with version 1.67.0 or newer of Rust. I tested v1.65.0 and v1.66.1 and they were unaffected. The 1.68.0-beta.2 is affected, and so is nightly-2023-02-06.
- Using the following Cargo profile:
[profile.maxperf]
inherits = "release"
lto = "fat"
codegen-units = 1
incremental = false
The regular release
profile does not trigger the error, even when all other conditions are met.
The version of the binary (Lighthouse) built doesn't seem to matter too much, tags v3.4.0
and v3.4.0-tree.2
both trigger the same error.
Lighthouse is open source and can be compiled locally (see build deps). It takes about 10 minutes on a fast machine to compile with the maxperf
profile. The exact command I've been using to test is:
cargo +beta install --path lighthouse --force --locked --features modern,gnosis --profile maxperf
You can also see a failed compilation on our public CI here.
Meta
info for 1.67.0:
rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-pc-windows-msvc
release: 1.67.0
LLVM version: 15.0.6
info for 1.66.1:
rustc 1.66.1 (90743e729 2023-01-10)
binary: rustc
commit-hash: 90743e7298aca107ddaa0c202a4d3604e29bfeb6
commit-date: 2023-01-10
host: x86_64-pc-windows-msvc
release: 1.66.1
LLVM version: 15.0.2
info for 1.68.0 beta:
rustc 1.68.0-beta.2 (10b73bf73 2023-02-01)
binary: rustc
commit-hash: 10b73bf73a6b770cd92ad8ff538173bc3298411c
commit-date: 2023-02-01
host: x86_64-pc-windows-msvc
release: 1.68.0-beta.2
LLVM version: 15.0.6
info for nightly:
rustc 1.69.0-nightly (e1eaa2d5d 2023-02-06)
binary: rustc
commit-hash: e1eaa2d5d4d1f5b7b89561a940718058d414e89c
commit-date: 2023-02-06
host: x86_64-pc-windows-msvc
release: 1.69.0-nightly
LLVM version: 15.0.7
MSVC info (not sure if this is relevant):
Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.28.29334
Error from 1.68.0-beta.2
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h39287a406bf356daE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %26, ptr noalias nocapture noundef nonnull dereferenceable(328) %10)
to label %32 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %47 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke void %95(ptr noundef align 1 %81, ptr noalias noundef nonnull readonly align 8 dereferenceable(128) %3)
to label %96 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h39287a406bf356daE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %8)
to label %105 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h39287a406bf356daE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %7)
to label %109 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h39287a406bf356daE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %143, ptr noalias nocapture noundef nonnull dereferenceable(328) %5)
to label %149 unwind label %172
The unwind destination does not have an exception handling instruction!
%156 = invoke fastcc noundef zeroext i1 @_ZN13futures_timer6native5delay5Delay6_reset17h6935682b885c489fE(ptr noalias noundef nonnull align 8 dereferenceable(8) %151, i64 noundef %153, i32 noundef %155)
to label %157 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %167 unwind label %172
CleanupPadInst not the first non-PHI instruction in the block.
%175 = cleanuppad within none []
in function _ZN94_$LT$libp2p_identify..handler..Handler$u20$as$u20$libp2p_swarm..handler..ConnectionHandler$GT$19on_connection_event17h8363995df26cfdb2E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `lighthouse`
error: failed to compile `lighthouse v3.4.0 (C:\Users\Michael\code\lighthouse\lighthouse)`, intermediate artifacts can be found at `C:\Users\Michael\code\lighthouse\target`
Error from 1.69.0-nightly (2023-02-06)
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h4f3823b6c507c1cfE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %26, ptr noalias nocapture noundef nonnull dereferenceable(328) %10)
to label %32 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %47 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke void %95(ptr noundef align 1 %81, ptr noalias noundef nonnull readonly align 8 dereferenceable(128) %3)
to label %96 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h4f3823b6c507c1cfE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %8)
to label %105 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h4f3823b6c507c1cfE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %99, ptr noalias nocapture noundef nonnull dereferenceable(328) %7)
to label %109 unwind label %172
The unwind destination does not have an exception handling instruction!
invoke fastcc void @"_ZN8smallvec17SmallVec$LT$A$GT$4push17h4f3823b6c507c1cfE"(ptr noalias noundef nonnull align 8 dereferenceable(1328) %143, ptr noalias nocapture noundef nonnull dereferenceable(328) %5)
to label %149 unwind label %172
The unwind destination does not have an exception handling instruction!
%156 = invoke fastcc noundef zeroext i1 @_ZN13futures_timer6native5delay5Delay6_reset17h6558842eb872485aE(ptr noalias noundef nonnull align 8 dereferenceable(8) %151, i64 noundef %153, i32 noundef %155)
to label %157 unwind label %172
CleanupReturnInst must unwind to an EH block which is not a landingpad.
cleanupret from %167 unwind label %172
CleanupPadInst not the first non-PHI instruction in the block.
%175 = cleanuppad within none []
in function _ZN94_$LT$libp2p_identify..handler..Handler$u20$as$u20$libp2p_swarm..handler..ConnectionHandler$GT$19on_connection_event17hd239e1ec01457673E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `lighthouse`
error: failed to compile `lighthouse v3.4.0 (C:\Users\Michael\code\lighthouse\lighthouse)`, intermediate artifacts can be found at `C:\Users\Michael\code\lighthouse\target`