[clang] Add noipa when lowering __attribute__((optnone)) (PR #218782)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 08:00:44 PDT 2026


jhuber6 wrote:

> ...but I wonder when that's actually desired...?

I was more interested in closing a local bug than arguing about LLVM semantics. IMO I think that `optnone` should not prevent IPO from making optimizations through the function, but should prevent optimizations in the function itself. This is different from putting `noipa` on everything. E.g.

```c
i32 foo() optnone {
  return 1;
}

i32 bar() {
  return foo();
}
```
Should still be able to optimize bar() to just `return 1;` IMO.

https://github.com/llvm/llvm-project/pull/218782


More information about the cfe-commits mailing list