|
|
|
|
|
by Ericson2314
2321 days ago
|
|
The earlier transformations are actually more impressive. Constant folding is almost always has a good RoI, so lots of compilers do it, and it's simple because, well, it's a constant there is no variables or partial eval needed. The others require lots of inlining before the final rule fires, and so are more ambitious. Seeing what pub fn sum3(n: i32) -> i32 {
(1..n).sum() + (1..2*n).sum() + (1..(n + 2)).sum()
}
does would be more interesting to me.Also, while all the inline is rustc, I assume the "triangle number trick" is LLVM. |
|