emscripten-core / emscripten-core/emscripten
wasm-ld crashes in MemorySSAUpdater
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 109
Description
In my project, when I link some of my bc files to churn out a wasm binary, I get this error
```
wasm-ld: /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/Analysis/MemorySSAUpdater.cpp:506: void llvm::MemorySSAUpdater::fixupDefs(const SmallVectorImpl &): Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed.
```
And this is the stack dump
```
#0 0x00007fcd27f70a83 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x1944a83)
#1 0x00007fcd27f6e82e llvm::sys::RunSignalHandlers() (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x194282e)
#2 0x00007fcd27f70f4f SignalHandler(int) Signals.cpp:0:0
#3 0x00007fcd2a5ad980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007fcd25cc3fb7 raise /build/glibc-S7xCS9/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007fcd25cc5921 abort /build/glibc-S7xCS9/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007fcd25cb548a __assert_fail_base /build/glibc-S7xCS9/glibc-2.27/assert/assert.c:89:0
#7 0x00007fcd25cb5502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#8 0x00007fcd296a1a00 llvm::MemorySSAUpdater::fixupDefs(llvm::SmallVectorImpl const&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x3075a00)
#9 0x00007fcd296a00ab llvm::MemorySSAUpdater::insertDef(llvm::MemoryDef*, bool) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x30740ab)
#10 0x00007fcd296aa111 void llvm::MemorySSAUpdater::moveTo(llvm::MemoryUseOrDef*, llvm::BasicBlock*, llvm::MemorySSA::InsertionPlace) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x307e111)
#11 0x00007fcd28ba4851 llvm::MergeBlockIntoPredecessor(llvm::BasicBlock*, llvm::DomTreeUpdater*, llvm::LoopInfo*, llvm::MemorySSAUpdater*, llvm::MemoryDependenceResults*, bool) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x2578851)
#12 0x00007fcd28f4749d llvm::GVN::runImpl(llvm::Function&, llvm::AssumptionCache&, llvm::DominatorTree&, llvm::TargetLibraryInfo const&, llvm::AAResults&, llvm::MemoryDependenceResults*, llvm::LoopInfo*, llvm::OptimizationRemarkEmitter*, llvm::MemorySSA*) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x291b49d)
#13 0x00007fcd28f46ef9 llvm::GVN::run(llvm::Function&, llvm::AnalysisManager&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x291aef9)
#14 0x00007fcd2a248a7d llvm::detail::PassModel >::run(llvm::Function&, llvm::AnalysisManager&) PassBuilder.cpp:0:0
#15 0x00007fcd2812dfd1 llvm::PassManager >::run(llvm::Function&, llvm::AnalysisManager&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x1b01fd1)
#16 0x00007fcd2a2404ed llvm::detail::PassModel >, llvm::PreservedAnalyses, llvm::AnalysisManager >::run(llvm::Function&, llvm::AnalysisManager&) PassBuilder.cpp:0:0
#17 0x00007fcd28132ed4 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x1b06ed4)
#18 0x00007fcd2a2407ad llvm::detail::PassModel >::run(llvm::Module&, llvm::AnalysisManager&) PassBuilder.cpp:0:0
#19 0x00007fcd2812cbf4 llvm::PassManager >::run(llvm::Module&, llvm::AnalysisManager&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x1b00bf4)
#20 0x00007fcd297cfb1e llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector > const&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x31a3b1e)
#21 0x00007fcd297d0131 llvm::lto::backend(llvm::lto::Config const&, std::function > (unsigned int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x31a4131)
#22 0x00007fcd297c4196 llvm::lto::LTO::runRegularLTO(std::function > (unsigned int)>) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x3198196)
#23 0x00007fcd297c3862 llvm::lto::LTO::run(std::function > (unsigned int)>, std::function > (unsigned int)> (unsigned int, llvm::StringRef)>) (emsdk/upstream/bin/../lib/libLLVM-13git.so+0x3197862)
#24 0x0000000000765496 lld::wasm::BitcodeCompiler::compile() (emsdk/upstream/bin/wasm-ld+0x765496)
#25 0x0000000000767189 lld::wasm::SymbolTable::addCombinedLTOObject() (emsdk/upstream/bin/wasm-ld+0x767189)
#26 0x00000000007508ee lld::wasm::(anonymous namespace)::LinkerDriver::linkerMain(llvm::ArrayRef) Driver.cpp:0:0
#27 0x000000000074b4ba lld::wasm::link(llvm::ArrayRef, bool, llvm::raw_ostream&, llvm::raw_ostream&) (emsdk/upstream/bin/wasm-ld+0x74b4ba)
#28 0x00000000003d545e lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) lld.cpp:0:0
#29 0x00000000003d4ff3 main (emsdk/upstream/bin/wasm-ld+0x3d4ff3)
#30 0x00007fcd25ca6bf7 __libc_start_main /build/glibc-S7xCS9/glibc-2.27/csu/../csu/libc-start.c:344:0
#31 0x00000000003d4cda _start (emsdk/upstream/bin/wasm-ld+0x3d4cda)
```
I'll be trying to narrow down the arguments passed into wasm-ld. But I'd thought of reaching out to see if anyone may have any idea about this as well.
Contributor guide
Assessment
This issue has not been assessed yet.