Skip to content

Commit b71b2a5

Browse files
authored
create guide to ICE-breaker groups and specifically advice for LLVM (#452)
1 parent 37b288e commit b71b2a5

File tree

4 files changed

+115
-1
lines changed

4 files changed

+115
-1
lines changed

src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
- [Coding conventions](./conventions.md)
2424
- [crates.io Dependencies](./crates-io.md)
2525
- [Emitting Errors and other Diagnostics](diagnostics.md)
26+
- [ICE-breaker teams](ice-breaker/about.md)
27+
- [LLVM ICE-breakers](ice-breaker/llvm.md)
2628
- [Part 2: How rustc works](./part-2-intro.md)
2729
- [High-level overview of the compiler source](./high-level-overview.md)
2830
- [The Rustc Driver and Interface](./rustc-driver.md)

src/codegen/debugging.md

+45-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,36 @@ $ ./build/$TRIPLE/llvm/bin/llvm-extract \
9494
> extracted.ll
9595
```
9696

97+
### Getting help and asking questions
98+
99+
If you have some questions, head over to the [rust-lang Zulip] and
100+
specifically the `#t-compiler/wg-llvm` stream.
101+
102+
[rust-lang Zulip]: https://rust-lang.zulipchat.com/
103+
104+
### Compiler options to know and love
105+
106+
The `-Chelp` and `-Zhelp` compiler switches will list out a variety
107+
of interesting options you may find useful. Here are a few of the most
108+
common that pertain to LLVM development (some of them are employed in the
109+
tutorial above):
110+
111+
- The `--emit llvm-ir` option emits a `<filename>.ll` file with LLVM IR in textual format
112+
- The `--emit llvm-bc` option emits in bytecode format (`<filename>.bc`)
113+
- Passing `-Cllvm-arg=<foo>` allows passing pretty much all the
114+
options that tools like llc and opt would accept;
115+
e.g. `-Cllvm-arg=-print-before-all` to print IR before every LLVM
116+
pass.
117+
- The `-Cno-prepopulate-passes` will avoid pre-populate the LLVM pass
118+
manager with a list of passes. This will allow you to view the LLVM
119+
IR that rustc generates, not the LLVM IR after optimizations.
120+
- The `-Cpasses=val` option allows you to supply a (space seprated) list of extra LLVM passes to run
121+
- The `-Csave-temps` option saves all temporary output files during compilation
122+
- The `-Zprint-llvm-passes` option will print out LLVM optimization passes being run
123+
- The `-Ztime-llvm-passes` option measures the time of each LLVM pass
124+
- The `-Zverify-llvm-ir` option will verify the LLVM IR for correctness
125+
- The `-Zno-parallel-llvm` will disable parallel compilation of distinct compilation units
126+
97127
### Filing LLVM bug reports
98128

99129
When filing an LLVM bug report, you will probably want some sort of minimal
@@ -119,4 +149,18 @@ create a minimal working example with Godbolt. Go to
119149
optimizations transform it.
120150

121151
5. Once you have a godbolt link demonstrating the issue, it is pretty easy to
122-
fill in an LLVM bug.
152+
fill in an LLVM bug. Just visit [bugs.llvm.org](https://bugs.llvm.org/).
153+
154+
### Porting bug fixes from LLVM
155+
156+
Once you've identified the bug as an LLVM bug, you will sometimes
157+
find that it has already been reported and fixed in LLVM, but we haven't
158+
gotten the fix yet (or perhaps you are familiar enough with LLVM to fix it yourself).
159+
160+
In that case, we can sometimes opt to port the fix for the bug
161+
directly to our own LLVM fork, so that rustc can use it more easily.
162+
Our fork of LLVM is maintained in [rust-lang/llvm-project]. Once
163+
you've landed the fix there, you'll also need to land a PR modifying
164+
our submodule commits -- ask around on Zulip for help.
165+
166+
[rust-lang/llvm-project]: https://github.com/rust-lang/llvm-project/

src/ice-breaker/about.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ICE-breakers
2+
3+
The **ICE-breaker groups** are an easy way to help out with rustc in a
4+
"piece-meal" fashion, without committing to a larger project.
5+
ICE-breaker groups are **[easy to join](#join)** (just submit a PR!)
6+
and joining does not entail any particular commitment.
7+
8+
Once you [join an ICE ICE-breaker group](#join), you will be added to
9+
a list that receives pings on github whenever a new issue is found
10+
that fits the ICE-breaker group's criteria. If you are interested, you
11+
can then [claim the issue] and start working on it.
12+
13+
Of course, you don't have to wait for new issues to be tagged! If you
14+
prefer, you can use the Github label for an ICE-breaker group to
15+
search for existing issues that haven't been claimed yet.
16+
17+
## What issues are a good fit for ICE-breaker groups?
18+
19+
"ICE-breaker issues" are intended to be **isolated** bugs of **middle
20+
priority**:
21+
22+
- By **isolated**, we mean that we do not expect large-scale refactoring
23+
to be required to fix the bug.
24+
- By **middle priority**, we mean that we'd like to see the bug fixed,
25+
but it's not such a burning problem that we are dropping everything
26+
else to fix it. The danger with such bugs, of course, is that they
27+
can accumulate over time, and the role of the ICE-breaker groups is
28+
to try and stop that from happening!
29+
30+
<a name="join"></a>
31+
32+
## Joining an ICE-breaker group
33+
34+
TBD -- we are building this mechanism right now! In the meantime, drop
35+
in on Zulip and leave your github name in [this topic][topic].
36+
37+
[topic]: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/llvm.20ice-breaker.20registration

src/ice-breaker/llvm.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# LLVM ICE-breakers
2+
3+
**Github Label:** [ICEBreaker-LLVM]
4+
5+
[ICEBreaker-LLVM]: https://github.com/rust-lang/rust/labels/ICEBreaker-LLVM
6+
7+
The "LLVM ICE-breakers" are focused on bugs that center around LLVM.
8+
These bugs often arise because of LLVM optimizations gone awry, or as
9+
the result of an LLVM upgrade. The goal here is:
10+
11+
- to determine whether the bug is a result of us generating invalid LLVM IR,
12+
or LLVM misoptimizing;
13+
- if the former, to fix our IR;
14+
- if the latter, to try and file a bug on LLVM (or identify an existing bug).
15+
16+
## Helpful tips and options
17+
18+
The ["Debugging LLVM"][d] section of the
19+
rustc-guide gives a step-by-step process for how to help debug bugs
20+
caused by LLVM. In particular, it discusses how to emit LLVM IR, run
21+
the LLVM IR optimization pipeliness, and so forth. You may also find
22+
it useful to look at the various codegen options listed under `-Chelp`
23+
and the internal options under `-Zhelp` -- there are a number that
24+
pertain to LLVM (just search for LLVM).
25+
26+
[d]: ../codegen/debugging.md
27+
28+
## If you do narrow to an LLVM bug
29+
30+
The ["Debugging LLVM"][d] section also describes what to do once
31+
you've identified the bug.

0 commit comments

Comments
 (0)