Skip to content

Instantly share code, notes, and snippets.

@unixod
Last active September 23, 2018 19:02
Show Gist options
  • Save unixod/38bbaaec1cdc108cfb6827e3c0556527 to your computer and use it in GitHub Desktop.
Save unixod/38bbaaec1cdc108cfb6827e3c0556527 to your computer and use it in GitHub Desktop.
LLVM IR analysis

Show hidden options

opt -help-hidden

How the set of passes '-O3' modifies IR.

$ opt -S -O3 file.ll

See target machine assembly.

$ opt -S -O3 file.ll | llc -O3
or
$ opt -S -O3 file.ll | llc -O3 --x86-asm-syntax=intel

(Note llc accepts ll-files as well but produces a different output, even with -O3 provided.)

What optimization passes are used for the '-O3' set.

$ opt -S -O3 -debug-pass=Arguments file.ll

See how MemorySSA is laid on an input IR.

$ opt -S -passes='print<memoryssa>' -disable-output file.ll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment