[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 04:23:55 PST 2022


pengfei added a comment.

In D84225#3303821 <https://reviews.llvm.org/D84225#3303821>, @lebedev.ri wrote:

> In D84225#3303771 <https://reviews.llvm.org/D84225#3303771>, @pengfei wrote:
>
>> In D84225#3302142 <https://reviews.llvm.org/D84225#3302142>, @rnk wrote:
>>
>>> I think LLVM already doesn't do some tail merging optimizations on inline asm, but allowing the use of the attribute is more principled, and will block more optimizations (CSE).
>>
>> IIRC, the initial requirment is to avoid the CSE like optimizations. We usually use inline asm for sepcial proposes. We have to stop the merge some time.
>
> Since the big hammer (`nomerge`) is already there i suppose this is fine,
> but given that there is little context in the original description,
> the wording makes it seem like it's being used to workaround
> something that may or may not be a bug in the first place.
>
> There isn't anything inherently wrong with merging inlineasm in general,
> if that does not break the constraints, especially since
> there's already a `sideeffect` keyword possible on the inlineasm.

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.


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