[llvm-dev] LLVM log file

Stefanos Baziotis via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 29 14:22:52 PST 2021


Well, I think that the easiest thing to do is something like that:
https://godbolt.org/z/xYWc7e
You basically make a simple regex saying show me anything that passes
matching loop or licm (loop-invariant code motion) have reported.

If you worry you may have missed a pass you want with this regex, you can
look either to the pipeline: https://godbolt.org/z/dvWchh (note that regex
should match argument names, not actual names e.g., -licm vs Loop-Invariant
Code Motion)
Or you can take a look at the list of LLVM passes:
https://llvm.org/docs/Passes.html
Most loop passes have inside them so you should be mostly ok.

For larger codes, or for easier parsing, you can just use
-fsave-optimization-record, like: clang test.c -c -O2
-fsave-optimization-record
It will basically show you the same things but in a more structured format
and it will output a .yaml file.
You can then sort out the passes you don't want either yourself or by
using:
https://clang.llvm.org/docs/UsersManual.html#cmdoption-foptimization-record-passes

If you're not satisfied with any of that, well, the next step I think is
-print-after-all (I mentioned above what it is and how to use it) because
e.g., some passes may not create reports.
Ideally, you would like something that shows you only the passes that
changed the IR, and there is supposed to be such a thing, -print-changed,
but for some reason it
doesn't work.

Please try those options and tell me whether they help.

Best,
Stefanos

Στις Παρ, 29 Ιαν 2021 στις 7:34 μ.μ., ο/η Sudakshina Dutta <
sudakshina at iitgoa.ac.in> έγραψε:

> Dear Stefanos,
>
> I want to know whether after loop optimization, llvm indicates which loop
> is optimized and what all optimizations have been applied successfully to
> the individual loop which is optimized. Suppose, the loop L1 is optimized
> and the optimizations t1, t2, t3 have been attempted and are actually
> applied also. Again, the loop L2 is optimized and  the optimizations t1,
> t2, t3 have been attempted and only t1 is finally applied. Does LLVM
> output the following ?
>
> Loop L1 : optimizations t1, t2, t3
> Loop L2 : optimization t1
>
> Thanks,
> Sudakshina
>
> On Fri, Jan 29, 2021 at 10:13 PM Michael Kruse <llvmdev at meinersbur.de>
> wrote:
>
>> Am Fr., 29. Jan. 2021 um 06:18 Uhr schrieb Sudakshina Dutta via
>> llvm-dev <llvm-dev at lists.llvm.org>:
>> > Thanks for all your reply. I have one simple question to ask. I am new
>> to llvm. I know that the loop to be optimized has to be enclosed between
>> #pragma scop and #pragma endoscop.
>>
>> #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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210130/3bfc0f56/attachment.html>


More information about the llvm-dev mailing list