LLVM-EXTRACT(1)

πŸ’… LLVM-EXTRACT(1) πŸ’…

okay so bestie, welcome to the LLVM manual page for llvm-extract, and no cap this one is actually such a useful little tool once you get it. grab a strawberry πŸ“ and let's go.


✨ NAME ✨

llvm-extract β€” extract a function from an LLVM module. literally that's the whole vibe, it pulls a function out. 🫢


🌈 SYNOPSIS 🌈

llvm-extract [options] --func function-name [filename]

πŸ¦‹ DESCRIPTION πŸ¦‹

so the llvm-extract command takes the name of a function and extracts it from the specified LLVM bitcode file. that's it, that's the job. πŸ’…

it's primarily used as a debugging tool to reduce test cases from larger programs that are triggering a bug. like, you've got this giant messy program and one tiny function is acting up β€” you don't need the whole thing, you just need the culprit. main character energy honestly. πŸ‘‘

and it's not just a copy-paste situation either: in addition to extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. so it's doing the cleanup too. icon. ✨

it reads its input from standard input if filename is omitted or if filename is -. and the output is always written to standard output, unless the -o option is specified (peep below, i got you). πŸ’–


πŸŽ€ OPTIONS πŸŽ€

  • --alias alias-name β€” extract the alias named function-name from the LLVM bitcode. may be specified multiple times to extract multiple alias at once. (yes bestie, "multiple alias", that's what it says, i don't make the rules πŸ™ˆ)
  • --ralias alias-regular-expr β€” extract the alias matching alias-regular-expr from the LLVM bitcode. all alias matching the regular expression will be extracted. may be specified multiple times. regex girlies rise πŸ”₯
  • --bb basic-block-specifier β€” extract basic block(s) specified in basic-block-specifier. may be specified multiple times. each <function:bb[;bb]> specifier pair will create a function. if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest. lowkey important, don't sleep on the dominance thing πŸ’€
  • --delete β€” delete specified Globals from Module. yep, it's giving destruction. 🫢
  • -f β€” enable binary output on terminals. normally, llvm-extract will refuse to write raw bitcode output if the output stream is a terminal. with this option, llvm-extract will write raw bitcode regardless of the output device. no vibe check, no safety net. 😭
  • --func function-name β€” extract the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. the classic. ⭐
  • --rfunc function-regular-expr β€” extract the function(s) matching function-regular-expr from the LLVM bitcode. all functions matching the regular expression will be extracted. may be specified multiple times.
  • --glob global-name β€” extract the global variable named global-name from the LLVM bitcode. may be specified multiple times to extract multiple global variables at once. globals deserve love too πŸ’œ
  • --rglob glob-regular-expr β€” extract the global variable(s) matching global-regular-expr from the LLVM bitcode. all global variables matching the regular expression will be extracted. may be specified multiple times. (note it says global-regular-expr in the description while the flag is --rglob β€” that's just how it's written, i'm not touching it πŸ™ˆ)
  • --keep-const-init β€” preserve the values of constant globals. keep the constants, bestie, they're precious. πŸ’–
  • --recursive β€” recursively extract all called functions. it goes deep. it goes all the way down. πŸŒ€
  • -help β€” print a summary of command line options. when in doubt, ask for help, that's growth 🌸
  • -o filename β€” specify the output filename. if filename is - (the default), then llvm-extract sends its output to standard output. so yeah, - is the default, no -o needed if you're happy with stdout πŸŽ€
  • -S β€” write output in LLVM intermediate language (instead of bitcode). human-readable era ✨

πŸ’€ EXIT STATUS πŸ’€

if llvm-extract succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value. simple as that, no plot twist 🫢


🌸 SEE ALSO 🌸

  • llvm-reduce(1) <llvm-reduce.html> β€” its sibling, its bestie, its partner in crime πŸ’œ

πŸ‘‘ Author πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). they're iconic for this, fr fr. 🧚


2003-2026, LLVM Project β€” that's a long reign, periodt. πŸ‘‘


okay that's the whole page bestie, mwah πŸ’‹ β€” this was page revision 23, dated 2026-10-20, and it's the LLVM-EXTRACT(1) manual. go extract something cute! πŸ¦‹βœ¨

πŸ“¦ where this page comes from
  • arch rolling: llvm 23.1.4-1 Β· Apache-2.0 WITH LLVM-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms