[llvm-bugs] [Bug 49896] New: FMF.isFast() returns incorrect result when FMF==0x7f

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 8 10:09:43 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49896

            Bug ID: 49896
           Summary: FMF.isFast() returns incorrect result when FMF==0x7f
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: melanie.blower at intel.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

I want to check whether the IR Builder FMF flags are set to isFast() in
clang/codegen

I have a test case that selects all the FMF flags on the cc1 command line,

I tried to write this code:
     auto FMF = Builder.getFastMathFlags();
     if (FMF.isFast())

but that didn't work, I had to write like this:
    if (FMF.allowReassoc() && FMF.noNaNs() && FMF.noInfs() &&
        FMF.noSignedZeros() && FMF.allowReciprocal() && FMF.allowContract() &&
        FMF.approxFunc())

That's because the implementation of isFast ultimately checks, in llvm
Operator.h, if the byte == ~0

OK to rewrite that check as byte == 0x7f?  I read a comment that the bits in
the struct are all used up, there's no 8th bit available at this time.

I don't have an easy reproducer, the patch I'm working on is
https://reviews.llvm.org/D100118 ; the line where I had to check each bits is
CGBuiltin.cpp:3829 in that patch. If I change it to isFast() then the first run
line in the test case fails, clang/test/CodeGen/arithmetic-fence-builtin.c

-- 
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/20210408/e0f592c3/attachment-0001.html>


More information about the llvm-bugs mailing list