[llvm-branch-commits] [BranchFolding] Fold away subsequent identical branches (PR #203110)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jun 14 22:49:47 PDT 2026


boomanaiden154 wrote:

So I think my current approach (deleting the basic block) is invalid because we might have other branches to that basic block that we're not rewriting. I think we want to delete the terminator of the previous block and let it fall through.

I also did some analysis on clang, and it turns out using clang to build clang in my configuration (x86-64 Linux) produces 6 redundant branch instructions, but they're all unconditional. So it would be good to generalize this to conditional and non-conditional branches.

https://github.com/llvm/llvm-project/pull/203110


More information about the llvm-branch-commits mailing list