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: unassignedclangb...@nondot.org
Reporter: antosh...@gmail.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs