[llvm] [LICM] Relax Hoistable Branch if all of the incoming node are hoistable (PR #225599)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 00:52:50 PDT 2026
nikic wrote:
> Ah, okay. I was looking into possible optimizations in LICM and found that this seemed like an easy TODO.
Just as a word of caution, implementing random TODOs in the LLVM code base is often not necessarily a good idea. They tend to document things that *could* be done, without making a judgement call on whether doing it is actually a good idea and worth the costs. We only really learned that leaving such TODOs is a bad idea with the advent of AI :)
> I have to say, the control-flow hoisting code here is really fragile, so I can understand why you think it should be deleted or removed. But do you still have the same opinion that it is essentially dead code? From what I found, it does actually enable an optimization (at least from valid LLVM IR).
The control flow hoisting code in LICM is not enabled by default. Looking back at the history, it was introduced in 2018, there an attempt to enable it that caused issues (massive compile-time regressions based on commit messages) and has been disabled since then.
So we can either try to bring this into a good enough shape to actually enable it, or we can remove this code (or we can keep ignoring it...) Unless there's some specific motivation for it, I'd favor dropping the code and simplifying LICM.
https://github.com/llvm/llvm-project/pull/225599
More information about the llvm-commits
mailing list