[llvm-bugs] [Bug 52565] New: -fno-approx-funcs doesn't override -Ofast or -ffast-math

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 19 15:11:00 PST 2021


            Bug ID: 52565
           Summary: -fno-approx-funcs doesn't override -Ofast or
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrew.kaylor at intel.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

If I compile the following code with 'clang -O2 -ffast-math -fno-approx-funcs'
the IR generated sets the 'fast' flag (implying 'afn' on the call and issues no
diagnostic indicating that the -fno-approx-funcs option was ignored.

#include <math.h>

float f(float x) {
  return logf(x);

define dso_local float @f(float %0) local_unnamed_addr #0 {
  %2 = tail call fast float @llvm.log.f32(float %0)
  ret float %2

attributes #0 = { mustprogress nofree nosync nounwind readnone uwtable
willreturn "approx-func-fp-math"="true"
"denormal-fp-math-f32"="ieee,ieee" "frame-pointer"="none"
"min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true"
"no-signed-zeros-fp-math"="true" "no-trapping-math"="true"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic"
"unsafe-fp-math"="true" }

D106191 needed many more changes to clang/lib/Driver/ToolChains/Clang.cpp to
get this option to interact correctly with the other floating point options.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211119/36f6ec27/attachment.html>

More information about the llvm-bugs mailing list