]> git.lizzy.rs Git - rust.git/commit
rollup merge of #19898: Aatch/issue-19684
authorAlex Crichton <alex@alexcrichton.com>
Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 21 Dec 2014 17:26:41 +0000 (09:26 -0800)
commit2af8155bee8614a4e3bd1831f8927652c7475cc5
tree2301b36dbd546cac3e36710e18a1d40053f634cd
parent25f8051f2ebdc9444e0f75e91dc0cbb45d194181
parent5722410f72d0698f6ad9ba668e2282ff0bac5043
rollup merge of #19898: Aatch/issue-19684

#16081 fixed an issue where a nested return statement would cause incorrect behaviour due to the inner return writing over the return stack slot that had already been written too. However, the check was very broad and picked many cases that wouldn't ever be affected by this issue.

As a result, the number of allocas increased dramatically and therefore stack-size increased. LLVM is not able to remove all of the extraneous allocas. Any code that had multiple return values in a compound expression at the end of a function (including loops) would be hit by the issue.

The check now uses a control-flow graph to only consider the case when the inner return is executed conditionally. By itself, this narrowed definition causes #15763 to return, so the control-flow graph is also used to avoid passing the return slot as a destination when the result won't be used.

This change allows the stack-size of the main rustc task to be reduced to 8MB from 32MB.
src/librustc/middle/cfg/mod.rs
src/librustc/middle/graph.rs
src/librustc_driver/lib.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/controlflow.rs
src/librustc_trans/trans/expr.rs