[PATCH] D143219: [llvm][TailDuplicator] permit taildup'ing pred MBB containing INLINEASM_BR

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 16:06:44 PST 2023


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:794
   // EH edges are ignored by analyzeBranch.
-  if (PredBB->succ_size() > 1)
+  if (PredBB->succ_size() > 1 && !PredBB->mayHaveInlineAsmBr())
     return false;
----------------
This doesn't seem right... the reasons we want to abort taildup are:

- There's a conditional branch, and we can't branch in the middle of a block.
- We can't merge two blocks that have different unwind destinations.
- We don't want multiple INLINEASM_BRs in a basic block, I think?

Checking `!PredBB->mayHaveInlineAsmBr()` shortcuts all those potential reasons.

-------

Might be worth considering implementing a form of taildup that doesn't merge the duplicated block with the predecessor; that would work in more cases without tripping over weird edge cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143219



More information about the llvm-commits mailing list