[PATCH] D154294: [Windows SEH]: Do not fold branches for MSVC TableSEH function

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 16 12:10:49 PDT 2023


efriedma added a comment.

> I also found two related patches rG161935520d5a9 <https://reviews.llvm.org/rG161935520d5a9cd1fcaddee39bb8438bcfec5552> and rG4600c064346 <https://reviews.llvm.org/rG4600c0643466114c20a557b74b233665105cf9bb> by @majnemer. Though they are targeting to funclets, I think the problem is similar, i.e., there're no edges to funclets so we have to make CFG irreducible manually.

Those patches enforce an invariant; "branches between funclets/into funclets/out of funclets are not legal".  Most passes won't do that because there isn't any control flow between the blocks in question; basically only BranchFolding and SimplifyCFG do that sort of fold, so it's not something people usually need to be aware of.  And for anything that does need to be aware, there's a MachineFunction method getEHScopeMembership() to generically query the property in question.

You could argue there's an invariant here you need to enforce, but you haven't even attempted to describe what the invariants in question are, so it's hard to assess whether other passes are likely to break them.  And you haven't provided a method to query for the invariant in question; instead, the personality function is hardcoded into BranchFolding.

I expect figuring all this out and documenting it properly is harder than just adding the relevant edges.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154294/new/

https://reviews.llvm.org/D154294



More information about the llvm-commits mailing list