Open pcwalton opened 3 years ago
It's worth noting that clang is doing better at equivalent C++ code. https://godbolt.org/z/zqT1z36es
Wonder if this is a pass ordering issue then.
There's LLVM code that already tries to do this. I guess it's not running on Rust for some reason? https://llvm.org/doxygen/SimplifyCFG_8cpp_source.html#l05786
I think I have an LLVM fix. Will post a patch upstream.
Should this issues be relabelled as A-LLVM?
Many times, people write matches on enums that are really loads from a table. It'd be nice if we could codegen them as such.
Here's an example, at https://godbolt.org/z/4P9v61an7:
The codegen here has a lot to be desired:
Deriving Debug can cause poor codegen too: https://godbolt.org/z/xnexGxo8e
There's some discussion on Twitter from LLVM folks that suggests this would be best as an MIR optzn: https://twitter.com/pcwalton/status/1436036809603960835