File: TipsAndTricks.rst

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (56 lines) | stat: -rw-r--r-- 2,469 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
==================================================
Tips and Tricks on using and contributing to Polly
==================================================

Committing to polly trunk
-------------------------
    - `General reference to git-svn workflow <https://stackoverflow.com/questions/190431/is-git-svn-dcommit-after-merging-in-git-dangerous>`_


Using bugpoint to track down errors in large files
--------------------------------------------------

    If you know the ``opt`` invocation and have a large ``.ll`` file that causes
    an error, ``bugpoint`` allows one to reduce the size of test cases.

    The general calling pattern is:

    - ``$ bugpoint <file.ll> <pass that causes the crash> -opt-args <opt option flags>``

    An example invocation is:

    - ``$ bugpoint crash.ll -polly-codegen -opt-args  -polly-canonicalize -polly-process-unprofitable``

    For more documentation on bugpoint, `Visit the LLVM manual <https://llvm.org/docs/Bugpoint.html>`_


Understanding which pass makes a particular change
--------------------------------------------------

    If you know that something like `opt -O3 -polly` makes a change, but you wish to
    isolate which pass makes a change, the steps are as follows:

    - ``$ bugpoint -O3 file.ll -opt-args -polly``  will allow bugpoint to track down the pass which causes the crash.

    To do this manually:

    - ``$ 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.
    - Bisect down to the pass that changes it.


Debugging regressions introduced at some unknown earlier point
--------------------------------------------------------------

In case of a regression in performance or correctness (e.g., an earlier version
of Polly behaved as expected and a later version does not), bisecting over the
version history is the standard approach to identify the commit that introduced
the regression.

LLVM has a single repository that contains all projects. It can be cloned at:
`<https://github.com/llvm/llvm-project>`_. How to bisect on a
git repository is explained here
`<https://www.metaltoad.com/blog/beginners-guide-git-bisect-process-elimination>`_.
The bisect process can also be automated as explained here:
`<https://www.metaltoad.com/blog/mechanizing-git-bisect-bug-hunting-lazy>`_.
An LLVM specific run script is available here:
`<https://gist.github.com/dcci/891cd98d80b1b95352a407d80914f7cf>`_.