Operations on CheckedInt should be constexpr
Categories
(Core :: MFBT, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: sg, Assigned: sg)
Details
Attachments
(1 file)
Comment 1•5 years ago
|
||
This is approximately easy to do, of course. It does, however, somewhat foreclose changing CheckedInt
functions to use compiler intrinsics to most efficiently (e.g. with direct knowledge of flags-register contents and specific instructions to implicitly observe these stateful results; in principle the compiler ought be able to understand this in plain ol' code; in practice I'm not sure they all do) perform computations with best-optimizable control flow. (At least, unless the intrinsics themselves are constexpr
. They might be, with some or all compilers.) This may or may not be something to concern ourselves over.
Assignee | ||
Comment 2•5 years ago
|
||
Builtins such as __builtin_add_overflow are constexpr
with GCC from at least 7.1 (the minimum supported version) and clang 7. They are not constexpr
for clang 5 and 6. I will submit a patch that adds constexpr
that handles this by reverting to not use the builtins with clang 5 and 6. If this is deemed not acceptable for performance reasons, it can be done in a different but less reabable way, using __builtin_constant_p
in each function using __builtin_*_overflow
. I am not sure how critical code generation with these old clang versions is.
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D56525
![]() |
||
Comment 5•5 years ago
|
||
bugherder |
Description
•