Re:How JavaScript works: inside the V8 engine
by eddyb on Tuesday August 22, 2017 @06:30AM
(#15071072)
This looks like yet-another-phase-ordering-issue in LLVM. I hit so many of these it's not even funny. Arguably one could find C code that shows the exact problem under clang. Example of optimized LLVM IR for that sample (press LLVM IR on https://play.rust-lang.org/?gist=b60ec85886eff967b21c7abc899...):
SimplifyCFG would instantly kill that. But it doesn't get to run again after whatever simplified the branch condition. I've heard rumors that LLVM is working on a new pass manager, maybe they will eventually fix this pervasive issue.
[ Parent
| on HN ]
Re:How JavaScript works: inside the V8 engine
by Veedrac on Tuesday August 22, 2017 @10:37AM
(#15072786)
Apologies for prodding a sore spot! The phase ordering problem is a well known demon for compilers; makes me wonder why I've not heard anything about unphased compilation.
Re:How JavaScript works: inside the V8 engine
by eddyb on Tuesday August 22, 2017 @02:04PM
(#15074914)
No worries, I'm just surprised you managed to find a simple testcase that exhibits it, so, really, thank you!
I've opened a (a bit vague for now) issue so at least I don't forget about it: https://github.com/rust-lang/rust/issues/44041
As for phase ordering - someone did show me recently VSDG, which claims to solve at least part of the problem (specifically, https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-705.pdf and http://sro.sussex.ac.uk/7576/1/Stanier%2C_James.pdf).