[llvm] [WebAssembly] Use RefTypeMem2Local instead of Mem2Reg (PR #83196)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 09:43:57 PST 2024


sbc100 wrote:

```
$ ./test/runner asan.test_externref_emjs_dynlink
Test suites:
['test_core']
Running test_core: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
test_externref_emjs_dynlink (test_core.asan.test_externref_emjs_dynlink) ... Call parameter type does not match function signature!
  %a.var = alloca ptr addrspace(10), align 1, addrspace(1)
 ptr  call void @llvm.lifetime.start.p0(i64 1, ptr addrspace(1) %a.var) #9
Call parameter type does not match function signature!
  %a.var = alloca ptr addrspace(10), align 1, addrspace(1)
 ptr  call void @llvm.lifetime.end.p0(i64 1, ptr addrspace(1) %a.var) #9
in function __original_main
fatal error: error in backend: Broken function found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fPIC -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Werror -fsanitize=address -Wno-unused-command-line-argument -mreference-types /usr/local/google/home/sbc/dev/wasm/emscripten/test/core/test_externref_emjs.c -c -o /tmp/emscripten_temp_ufkuzr50/test_externref_emjs_0.o
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/usr/local/google/home/sbc/dev/wasm/emscripten/test/core/test_externref_emjs.c'.
4.	Running pass 'Module Verifier' on function '@__original_main'
 #0 0x00007f993f3862b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x1862b8)
 #1 0x00007f993f383f2e llvm::sys::RunSignalHandlers() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x183f2e)
 #2 0x00007f993f385691 llvm::sys::CleanupOnSignal(unsigned long) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x185691)
 #3 0x00007f993f2c3e27 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #4 0x00007f993f2c3dbf llvm::CrashRecoveryContext::HandleExit(int) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0xc3dbf)
 #5 0x00007f993f380c87 llvm::sys::Process::Exit(int, bool) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x180c87)
 #6 0x000056150befe183 (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang+0x12183)
 #7 0x00007f993f2d60cc llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0xd60cc)
 #8 0x00007f993f2d5fb6 (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0xd5fb6)
 #9 0x00007f993f93bf80 void llvm::VerifierSupport::WriteTs<llvm::Instruction*, llvm::MDNode const*>(llvm::Instruction* const&, llvm::MDNode const* const&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x33bf80)
#10 0x00007f993f88f05a llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x28f05a)
#11 0x00007f993f8974e2 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x2974e2)
#12 0x00007f993f88fb72 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x28fb72)
#13 0x00007f99438e4759 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__2::unique_ptr<llvm::raw_pwrite_stream, std::__2::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangCodeGen.so.19.0git+0xe4759)
#14 0x00007f9943d2ef04 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangCodeGen.so.19.0git+0x52ef04)
#15 0x00007f993d2fa0f6 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/../lib/libclangParse.so.19.0git+0x370f6)
#16 0x00007f9941f4549f clang::FrontendAction::Execute() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontend.so.19.0git+0x14549f)
#17 0x00007f9941eaf0ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontend.so.19.0git+0xaf0ad)
#18 0x00007f994525d590 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangFrontendTool.so.19.0git+0x4590)
#19 0x000056150befcf13 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang+0x10f13)
#20 0x000056150befa75b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x00007f9941acf749 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
#22 0x00007f993f2c3d56 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0xc3d56)
#23 0x00007f9941aced92 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.19.0git+0xced92)
#24 0x00007f9941a8887c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.19.0git+0x8887c)
#25 0x00007f9941a88b6e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__2::pair<int, clang::driver::Command const*>>&, bool) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.19.0git+0x88b6e)
#26 0x00007f9941aac56f clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__2::pair<int, clang::driver::Command const*>>&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libclangDriver.so.19.0git+0xac56f)
#27 0x000056150bef99d2 clang_main(int, char**, llvm::ToolContext const&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang+0xd9d2)
#28 0x000056150bf08a17 main (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang+0x1ca17)
#29 0x00007f99402456ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#30 0x00007f9940245785 call_init ./csu/../csu/libc-start.c:128:20
#31 0x00007f9940245785 __libc_start_main ./csu/../csu/libc-start.c:347:5
#32 0x000056150bef6bba _start (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang+0xabba)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.0.0git (https://github.com/sbc100/llvm-project 403b9cf1bb29d550c419ac5ecd2f764bf5cfa3c0)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/google/home/sbc/dev/wasm/llvm-build/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test_externref_emjs-b471d9.c
clang: note: diagnostic msg: /tmp/test_externref_emjs-b471d9.sh
clang: note: diagnostic msg: 

********************
emcc: error: '/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fPIC -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot -DEMSCRIPTEN -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Werror -fsanitize=address -Wno-unused-command-line-argument -mreference-types /usr/local/google/home/sbc/dev/wasm/emscripten/test/core/test_externref_emjs.c -c -o /tmp/emscripten_temp_ufkuzr50/test_externref_emjs_0.o' failed (returned 1)


```

https://github.com/llvm/llvm-project/pull/83196


More information about the llvm-commits mailing list