[PATCH] D129231: [Builtins] Do not claim all libfuncs are readnone with trapping math.

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 8 08:07:45 PDT 2022


john.brawn added a comment.

Looking at the descriptions of maths functions in C99 (and I expect C11 will be the same) it looks like there are three kinds:

- Those that can report error by errno and floating-point exeption, and may also raise the inexact exception
- Those that don't set errno, but may raise the inexact exception
- Those that neither set errno or raise an exception

Looking at this patch and the attributes of the various function intrinsics it looks like you have:

- Marked "e": Can set errno, can't raise exception
- Marked "eg": Can set errno and raise exception
- Marked "cg": Can't set errno, can raise an exception
- Marked "c": Can't set errno or raise an exception

Given that the functions that set errno also raise exceptions I think it would make sense to have the "e" attribute cover both errno and exceptions, and have "g" just for those that can only raise exceptions. Also "cg" looks like it's probably wrong and should be "g" (given that "c" means "always const" and "g" means "const only when we don't have exceptions", and that's also how "e" is used in that we don't have functions with "cg").


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129231/new/

https://reviews.llvm.org/D129231



More information about the cfe-commits mailing list