Open XChy opened 7 months ago
Hm, I thought that @dtcxzyw recently added support for this.
Hm, I thought that @dtcxzyw recently added support for this.
Oh, sorry for duplicating it. It seems that opt on Alive2 doesn't optimize the case without switch, but godbolt does: https://godbolt.org/z/KxMn1Mbnd However, the switch case in real world isn't optimized: https://godbolt.org/z/Wcz73rdP6
Edit: And could you post the link of patch posted by @dtcxzyw? I can't find it.
@XChy The patch is https://github.com/llvm/llvm-project/pull/82803. It landed recently, and I think alive2 updates fairly rarely.
Hm, I thought that @dtcxzyw recently added support for this.
Emm, currently DomConditionCache doesn't support switches. @nikic Do you plan to fix it?
Alive2 proof: https://alive2.llvm.org/ce/z/NdBYVJ
Motivating example
can be folded to:
Real-world motivation
This snippet of IR is derived from qemu/hw/core/loader.c@load_aout (after O3 pipeline). The example above is a reduced version. If you're interested in the original suboptimal IR and optimal IR, see also:https://godbolt.org/z/Woa6n1rW1
Let me know if you can confirm that it's an optimization opportunity, thanks.