[clang] Fix math-errno issue (PR #66381)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 12:23:02 PDT 2023


================
@@ -2339,6 +2345,28 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
   // LLVM counterparts if the call is marked 'const' (known to never set errno).
   // In case FP exceptions are enabled, the experimental versions of the
   // intrinsics model those.
+  bool ConstAlways =
+      getContext().BuiltinInfo.isConst(BuiltinID);
+
+  // There's a special case with the fma builtins where they are always const
+  // if the target environment is GNU or the target is OS is Windows and we're
+  // targeting the MSVCRT.dll environment.
+  switch (BuiltinID) {
----------------
AaronBallman wrote:

I worry about this list getting out of sync with reality again; it would be nice if we had some way to get this information out of `BuiltinInfo` instead of having a separate list here. If that's a difficult change to make, I don't insist on it happening now, but then we should add a FIXME comment to remember to come back and clean this up.

https://github.com/llvm/llvm-project/pull/66381


More information about the cfe-commits mailing list