[llvm-bugs] [Bug 41343] __attribute__((optnone)) not respected for included lambda

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 2 11:28:38 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41343

Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rnk at google.com
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #1 from Reid Kleckner <rnk at google.com> ---
We already have a different facility for disabling optimizations over a region
of code (#pragma clang optimize off/on):
https://bcain-llvm.readthedocs.io/projects/clang/en/latest/LanguageExtensions/#extensions-for-selectively-disabling-optimization

You can also explicitly mark the lambda optnone if you like:
template <typename T> void Test<T>::init() {
  [&]() __attribute__((optnone)) { this->template doThis<int>(); }();
  this->template doThat<int>();
};
That seems to work for me.

It's possible that my brain has been broken by working too long on compilers,
because our current behavior seems quite logical to me. I quizzed my coworkers,
and the consensus was that it's probably not worth the effort and code
complexity to change how we look for this specific attribute. There are two
other existing ways to get the behavior you want, so I don't think it's likely
that we will make this change.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190402/b9a9d43c/attachment.html>


More information about the llvm-bugs mailing list