[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 01:35:44 PDT 2024
farzonl wrote:
> This broke building wasi-libc, with a crash:
>
> ```
> Stack dump:
> 0. Program arguments: /builds/worker/fetches/clang/bin/clang-19 -cc1 -triple wasm32-unknown-wasi -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ctanh.c -mrelocation-model static -mthread-model single -mframe-pointer=none -ffp-contract=on -fno-rounding-math -ffp-exception-behavior=ignore -mconstructor-aliases -target-cpu generic -fvisibility=hidden -debugger-tuning=gdb -fdebug-compilation-dir=/builds/worker/fetches/wasi-sdk/src/wasi-libc -fcoverage-compilation-dir=/builds/worker/fetches/wasi-sdk/src/wasi-libc -sys-header-deps -D NDEBUG -O2 -Wall -Wextra -Wno-null-pointer-arithmetic -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-ignored-attributes -Wno-missing-braces -Wno-ignored-pragmas -Wno-unused-but-set-variable -Wno-unknown-warning-option -Wno-parentheses -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wno-logical-op-parentheses -Wno-string-plus-int -Wno-dangling-else -Wno-unknown-pragmas -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -x c ctanh-46a6c8.c
> 1. <eof> parser at end of file
> 2. Code generation
> 3. Running pass 'Function Pass Manager' on module 'ctanh-46a6c8.c'.
> 4. Running pass 'WebAssembly Assembly Printer' on function '@ctanh'
> #0 0x00007f2205ba35cd llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:723:11
> #1 0x00007f2205ba3abb PrintStackTraceSignalHandler(void*) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:798:1
> #2 0x00007f2205ba1b26 llvm::sys::RunSignalHandlers() /tmp/llvm/llvm/lib/Support/Signals.cpp:105:5
> #3 0x00007f2205ba4275 SignalHandler(int) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:413:1
> #4 0x00007f2203ff4f90 (/lib/x86_64-linux-gnu/libc.so.6+0x3bf90)
> #5 0x00007f2204043ccc (/lib/x86_64-linux-gnu/libc.so.6+0x8accc)
> #6 0x00007f2203ff4ef2 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3bef2)
> #7 0x00007f2203fdf472 abort (/lib/x86_64-linux-gnu/libc.so.6+0x26472)
> #8 0x00007f2205a7f300 llvm::install_out_of_memory_new_handler() /tmp/llvm/llvm/lib/Support/ErrorHandling.cpp:194:0
> #9 0x00007f220ba5052d llvm::WebAssembly::getLibcallSignature(llvm::WebAssemblySubtarget const&, llvm::StringRef, llvm::SmallVectorImpl<llvm::wasm::ValType>&, llvm::SmallVectorImpl<llvm::wasm::ValType>&) /tmp/llvm/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp:907:30
> #10 0x00007f220b9c4e0f llvm::WebAssemblyAsmPrinter::getOrCreateWasmSymbol(llvm::StringRef) /tmp/llvm/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:0:5
> #11 0x00007f220b9c4f46 llvm::WebAssemblyAsmPrinter::emitDecls(llvm::Module const&) /tmp/llvm/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:310:40
> #12 0x00007f220b9c7179 llvm::WebAssemblyAsmPrinter::emitConstantPool() /tmp/llvm/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:604:3
> #13 0x00007f2206ee9526 llvm::AsmPrinter::emitFunctionHeader() /tmp/llvm/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:966:3
> ```
>
> This file contains the script and preprocessed source that reproduce the problem: [ctanh.zip](https://github.com/user-attachments/files/15783347/ctanh.zip)
This seems to be because the WASM backend does some non standard things setting up a libcall to type signature map. I put up a fix #95082. I typically would just revert, but the fix is so compact i think it makes more sense to merge a fix to unblock. That said i'm not a regular WASM contributor so i'm going to go back to bed and wait till i get some guidance from those folks.
https://github.com/llvm/llvm-project/pull/94559
More information about the cfe-commits
mailing list