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

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 22:51:46 PST 2022


pengfei added a comment.

In D84225#3305140 <https://reviews.llvm.org/D84225#3305140>, @rnk wrote:

> 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.

Thanks @rnk . Yes, so we emit `endbr` in a backend pass rather than this way. I just want to demonstrate why we can't merge inline asm sometime. I don't have a better example at a short time :)


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