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

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 12:49:19 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) {
----------------
zahiraam wrote:

Can the special case in the math-errno fix concerning "fma" become actually a list of those? Aaron is worried that the list can become out of sync. We could get the name of the builtin via the getContext().BuiltinInfo.getName(BuiltinID); and work with that. Then we don't have to have a list here?

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


More information about the cfe-commits mailing list