_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
I used “-print-changed”, “-print-before-all”, “print-after-all” last time I wanted to see the passes together with their inout/output IR modules.
In my case, I used them through “clang++”, i.e. I had to prefix them with “-mllvm”
> clang++ test_file.cpp -mllvm -print-after-all
Hi Sudakshina,Glad it helped :)> I did not find any 'print-changed' option for llvm.Hmm.. I can't reproduce it myself right now either.. Anyway, let's go with what works for sure. That's `-print-after-all`. This prints the IR after every (middle-end) pass, no matter whether the pass made any changes or not.Alright, now to use that: This is _not_ an option of Clang (or the Clang driver; i.e., the command: clang test.c -print-after-all won't work), but an option of opt.
I think this is sufficiently close to being true that it ends up being
very misleading. I've seen a lot of posts on the mailing lists from
people who have a mental model of LLVM like this.
The opt tool is a thin wrapper around the LLVM pass pipeline
infrastructure. Most of the command-line flags for opt are not specific
to opt, they are exposed by LLVM libraries. Opt passes all of its
arguments to LLVM, clang passes only the ones prefixed with -mllvm, but
they are both handled by the same logic.
Opt has some default pipelines with names such as -O1 and -O3 but these
are *not* the same as the pipelines of the same names in clang (or other
compilers that use LLVM). This is a common source of confusion from
people wondering why clang and opt give different output at -O2 (for
example).
The opt tool is primarily intended for unit testing. It is a convenient
way of running a single pass or sequence of passes (which is also useful
for producing reduced test cases when a long pass pipeline generates a
miscompile). Almost none of the logic, including most of the
command-line handling, is actually present in opt.
David
#pragma scop/endscop are used by polyhedral source-to-source
optimizers such as ppcg[1] and OpenScop[2]. LLVM's polyhedral
optimizer Polly does not use them.
Polly has several report options available, such as
`-Rpass-analysis=polly-scops`, `-mllvm -polly-report`, `-mllvm
-polly-show`.
[1] https://repo.or.cz/ppcg.git
[2] http://icps.u-strasbg.fr/~bastoul/development/openscop/index.html
Michael