xref: /llvm-project/polly/docs/TipsAndTricks.rst (revision 27f7546f336263b0b9b569e0c8ec99a164c89d8f)
1c7050032SSiddharth Bhat==================================================
2c7050032SSiddharth BhatTips and Tricks on using and contributing to Polly
3c7050032SSiddharth Bhat==================================================
4c7050032SSiddharth Bhat
5*27f7546fSKazu HirataCommitting to polly trunk
6*27f7546fSKazu Hirata-------------------------
7c7050032SSiddharth Bhat    - `General reference to git-svn workflow <https://stackoverflow.com/questions/190431/is-git-svn-dcommit-after-merging-in-git-dangerous>`_
8c7050032SSiddharth Bhat
9c7050032SSiddharth Bhat
10c7050032SSiddharth BhatUsing bugpoint to track down errors in large files
11c7050032SSiddharth Bhat--------------------------------------------------
12c7050032SSiddharth Bhat
13c7050032SSiddharth Bhat    If you know the ``opt`` invocation and have a large ``.ll`` file that causes
14c7050032SSiddharth Bhat    an error, ``bugpoint`` allows one to reduce the size of test cases.
15c7050032SSiddharth Bhat
16c7050032SSiddharth Bhat    The general calling pattern is:
17c7050032SSiddharth Bhat
18c7050032SSiddharth Bhat    - ``$ bugpoint <file.ll> <pass that causes the crash> -opt-args <opt option flags>``
19c7050032SSiddharth Bhat
20c7050032SSiddharth Bhat    An example invocation is:
21c7050032SSiddharth Bhat
22c7050032SSiddharth Bhat    - ``$ bugpoint crash.ll -polly-codegen -opt-args  -polly-canonicalize -polly-process-unprofitable``
23c7050032SSiddharth Bhat
2472fd1033SSylvestre Ledru    For more documentation on bugpoint, `Visit the LLVM manual <https://llvm.org/docs/Bugpoint.html>`_
25c7050032SSiddharth Bhat
26c7050032SSiddharth Bhat
27c7050032SSiddharth BhatUnderstanding which pass makes a particular change
28c7050032SSiddharth Bhat--------------------------------------------------
29c7050032SSiddharth Bhat
30c7050032SSiddharth Bhat    If you know that something like `opt -O3 -polly` makes a change, but you wish to
31c7050032SSiddharth Bhat    isolate which pass makes a change, the steps are as follows:
32c7050032SSiddharth Bhat
33c7050032SSiddharth Bhat    - ``$ bugpoint -O3 file.ll -opt-args -polly``  will allow bugpoint to track down the pass which causes the crash.
34c7050032SSiddharth Bhat
35c7050032SSiddharth Bhat    To do this manually:
36c7050032SSiddharth Bhat
37c7050032SSiddharth Bhat    - ``$ opt -O3 -polly -debug-pass=Arguments`` to get all passes that are run by default. ``-debug-pass=Arguments`` will list all passes that have run.
38c7050032SSiddharth Bhat    - Bisect down to the pass that changes it.
39c7050032SSiddharth Bhat
403addd89dSTobias Grosser
413addd89dSTobias GrosserDebugging regressions introduced at some unknown earlier point
423addd89dSTobias Grosser--------------------------------------------------------------
433addd89dSTobias Grosser
443addd89dSTobias GrosserIn case of a regression in performance or correctness (e.g., an earlier version
453addd89dSTobias Grosserof Polly behaved as expected and a later version does not), bisecting over the
463addd89dSTobias Grosserversion history is the standard approach to identify the commit that introduced
473addd89dSTobias Grosserthe regression.
483addd89dSTobias Grosser
493addd89dSTobias GrosserLLVM has a single repository that contains all projects. It can be cloned at:
505d71fc5dSJames Y Knight`<https://github.com/llvm/llvm-project>`_. How to bisect on a
513addd89dSTobias Grossergit repository is explained here
52ce995892SHans Wennborg`<https://www.metaltoad.com/blog/beginners-guide-git-bisect-process-elimination>`_.
53c016d2d0STobias GrosserThe bisect process can also be automated as explained here:
54c016d2d0STobias Grosser`<https://www.metaltoad.com/blog/mechanizing-git-bisect-bug-hunting-lazy>`_.
55c016d2d0STobias GrosserAn LLVM specific run script is available here:
56c016d2d0STobias Grosser`<https://gist.github.com/dcci/891cd98d80b1b95352a407d80914f7cf>`_.
57