[llvm-bugs] [Bug 39072] New: valueless_by_exception() should unconditionally return false if all the constructors are noexcept
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 25 03:25:16 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39072
Bug ID: 39072
Summary: valueless_by_exception() should unconditionally return
false if all the constructors are noexcept
Product: libc++
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: antoshkka at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Right now the variant::valueless_by_exception() is defined like that:
constexpr bool valueless_by_exception() const noexcept {
return index() == variant_npos;
}
Above code is quite complex for the optimizer. It may be profitable to detect
variant types that never have valueless_by_exception() state and re-implement
the function:
constexpr bool valueless_by_exception() const noexcept {
return !__always_valid::value /*compile-time constant*/ && index() ==
variant_npos;
}
Such change would improve assembly for multiple functions including
comparisons, swap, get and constructors.
--
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/20180925/7060afd7/attachment.html>
More information about the llvm-bugs
mailing list