https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118864

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Confirmed.  Does the clang version work for function pointer types and
> indirect calls?

Yes but in an interesting way it seems.
The examples from their documentation:
```
[[clang::nomerge]] void foo(int) {}

void bar(int x) {
  auto *ptr = foo;
  if (x) foo(1); else foo(2); // will not be merged
  if (x) ptr(1); else ptr(2); // indirect call, can be merged
}
```

```
[[clang::nomerge]] void (*foo)(int);

void bar(int x) {
  auto *ptr = foo;
  if (x) foo(1); else foo(2); // will not be merged
  if (x) ptr(1); else ptr(2); // 'ptr' has no 'nomerge' attribute, can be
merged
}
```

>From the looks of it, this is purely a front-end attribute which then gets
attached to the call statement rather than the attribute staying of the
types/function for the middle-end.

Reply via email to