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 π
--aliasalias-name β extract the alias namedfunction-namefrom 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 π)--raliasalias-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 π₯--bbbasic-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-extractwill refuse to write raw bitcode output if the output stream is a terminal. with this option,llvm-extractwill write raw bitcode regardless of the output device. no vibe check, no safety net. π--funcfunction-name β extract the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. the classic. β--rfuncfunction-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.--globglobal-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 π--rglobglob-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 πΈ-ofilename β specify the output filename. if filename is-(the default), thenllvm-extractsends its output to standard output. so yeah,-is the default, no-oneeded 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. π§
π Copyright π
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