This is an archive of the discontinued LLVM Phabricator instance.

[libc][NFC] Add noreturn and constexpr qualifiers where appropriate
ClosedPublic

Authored by gAlfonso-bit on Jul 26 2021, 9:53 AM.

Details

Summary

These functions make it clear to the compiler and user what the intended
behavior is so llvm can make them go as fast as possible.

Diff Detail

Event Timeline

gAlfonso-bit created this revision.Jul 26 2021, 9:53 AM
gAlfonso-bit requested review of this revision.Jul 26 2021, 9:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2021, 9:53 AM

noexcept is superfluous because all LLVM is compiled with -fno-exceptions

Well that helps me out a LOT.

There's LLVM_ENABLE_EH cmake switch, not sure how it affects llvmlibc.

gAlfonso-bit retitled this revision from [libc] Add noexcept and noreturn qualifiers to appropriate C lib functions to [libc] Add noreturn, constexpr, and static_cast qualifiers to appropriate C lib functions.
gAlfonso-bit edited the summary of this revision. (Show Details)

I have marked those files in which the changes are OK. Please update and I can submit this patch for you.

libc/src/__support/integer_operations.h
14

Changes in this file OK.

libc/src/ctype/ctype_utils.h
18

Changes in this file OK.

libc/utils/HdrGen/Command.h
36

Changes in this file OK.

llvm/include/llvm/Support/Compiler.h
27

You will need to move the changes in this file out to a different patch and get it reviewed by a suitable reviewer. Also, as I have suggested previously, do not mixup style cleanups with the actual intention of the patches.

gAlfonso-bit marked 4 inline comments as done.

Fixed according to feedback

gAlfonso-bit retitled this revision from [libc] Add noreturn, constexpr, and static_cast qualifiers to appropriate C lib functions to [libc] Add noreturn and constexpr qualifiers to appropriate C lib functions.Jul 27 2021, 11:47 AM

Moved ctype function changes to its own diff. This diff now has every requested change!

gAlfonso-bit retitled this revision from [libc] Add noreturn and constexpr qualifiers to appropriate C lib functions to [libc]{NFC] Add noreturn and constexpr qualifiers to appropriate C lib functions.Jul 27 2021, 2:10 PM
gAlfonso-bit retitled this revision from [libc]{NFC] Add noreturn and constexpr qualifiers to appropriate C lib functions to [libc][NFC] Add noreturn and constexpr qualifiers to appropriate C lib functions.Jul 27 2021, 4:58 PM
gAlfonso-bit updated this revision to Diff 362255.EditedJul 27 2021, 6:20 PM

@sivachandra Everything is ready for landing!

gAlfonso-bit added a subscriber: MaskRay.
gAlfonso-bit edited reviewers, added: ldionne; removed: MaskRay.Jul 28 2021, 8:40 AM

@ldionne May I ask if this is acceptable?

Rebased to LLVM 13's Release Branch

sivachandra accepted this revision.Jul 28 2021, 9:15 AM

The frequent updates and repeated pinging of reviewers is almost like spamming us.
Please see https://llvm.org/docs/Contributing.html#how-to-submit-a-patch where it says that a good practice is to ping after a week of silence.

Again, don't get me wrong - I totally appreciate you doing this but we all have our own jobs and work which makes patches like this drop down in priority. That said, I have accepted this patch and will submit it for you some time day (US west coast time).

This revision is now accepted and ready to land.Jul 28 2021, 9:15 AM
gAlfonso-bit added a comment.EditedJul 28 2021, 9:16 AM

The frequent updates and repeated pinging of reviewers is almost like spamming us.
Please see https://llvm.org/docs/Contributing.html#how-to-submit-a-patch where it says that a good practice is to ping after a week of silence.

Again, don't get me wrong - I totally appreciate you doing this but we all have our own jobs and work which makes patches like this drop down in priority. That said, I have accepted this patch and will submit it for you some time day (US west coast time).

Ok, I read it. I apologize and should have read it earlier. I am sorry.

I was in a rush since I was hoping to get my changes in the release branch.

I definitely should have considered the people I was pinging first though. I will follow these guidelines from now on.

sivachandra retitled this revision from [libc][NFC] Add noreturn and constexpr qualifiers to appropriate C lib functions to [libc][NFC] Add noreturn and constexpr qualifiers where appropriate.Jul 28 2021, 9:44 PM
sivachandra edited the summary of this revision. (Show Details)