about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-04-10 18:15:19 +0200
committerGitHub <noreply@github.com>2020-04-10 18:15:19 +0200
commit0d892873d84c3aca95715eb162d5941e278761ef (patch)
treecaadf38c39d48ccbc7c8d8d5b0e080a8307c4b9c /src/rustllvm/RustWrapper.cpp
parent6b2df46b2e25c20ce825c293bfc367846513560b (diff)
parent0fc0f34ae4fdae562b445e26778c64d60b69cf02 (diff)
downloadrust-0d892873d84c3aca95715eb162d5941e278761ef.tar.gz
rust-0d892873d84c3aca95715eb162d5941e278761ef.zip
Rollup merge of #70973 - ecstatic-morse:recursion-lint, r=jonas-schievink
Use forward traversal for unconditional recursion lint

While reviewing #70822, I noted that #54444 could be solved without requiring the predecessor graph and without allocating a `Vec<Span>` for every basic block. The unconditional recursion lint is not a performance bottleneck however, so I approved #70822 as it was.

Nevertheless, I wanted to try implementing my idea using `TriColorDepthFirstSearch`, which is a DFS that can differentiate between [forward/tree edges and backward ones](https://en.wikipedia.org/wiki/Depth-first_search#Output_of_a_depth-first_search). I found this approach more straightforward than the existing one, so I'm opening this PR to see if it is desirable.

The pass is now just a DFS across the control-flow graph. We ignore false edges and false unwinds, as well as the successors of recursive calls, just like existing pass does. If we see a back-edge (loop) or a terminator that would cause us to yield control-flow back to the caller (`Return`, `Resume`, etc.), we know that the function does not unconditionally recurse.

r? @jonas-schievink
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions