Auto merge of #72205 - ecstatic-morse:nrvo, r=oli-obk
Dumb NRVO This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis. I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges. r? @ghost
Showing
src/test/codegen/nrvo.rs
0 → 100644
src/test/mir-opt/nrvo-simple.rs
0 → 100644
想要评论请 注册 或 登录