[PATCH] D84225: [CFE] Add nomerge function attribute to inline assembly.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 09:34:30 PST 2022


rnk added a comment.

In D84225#3304189 <https://reviews.llvm.org/D84225#3304189>, @pengfei wrote:

> It's not a workaround. We do need to avoid the merging sometime. For example, given we have 2 branches begin with inline asm of `endbr`. We have to use `nomerge` to stop them been merged out of the branches. `sideeffect` doesn't help with that.

That doesn't sound sufficient to ensure that `endbr` will be the first instruction in that basic block, which I'm guessing is a requirement. PHI nodes might cause register copies / spills to appear before `endbr`, and instrumentation passes typically insert code at the top of basic blocks. It sounds like we might need a more complete solution for tracking indirect branch target blocks. Maybe `indirectbr` and basic block addresses already feed into this, but I'm out of my depth here.

Anyway, I don't want to make a value judgment here. I'm in favor of this change. We should allow users to apply `nomerge` to inline asm, whether it is a workaround or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84225



More information about the cfe-commits mailing list