[llvm-bugs] [Bug 52259] New: Fast Math Flags not propagated to phis/select instructions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 21 16:43:34 PDT 2021


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

            Bug ID: 52259
           Summary: Fast Math Flags not propagated to phis/select
                    instructions
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mnadeem at quicinc.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Consider the following code compiled with -Ofast.

double floatingAbs(double x) {
    if (x < 0)
        return -x;
    else
        return x;
}


This should produce a "fabs" but the compiler is unable to do produce one
because the select instruction in the IR does not have any fast flags.

>From my analysis:
SROA          -> creates a Phi node without any fast flags.
SimplifyCFG   -> converts the Phi to a select and copies the Phi's fast flags,
                 unfortunately the phi does not have any fast flags to begin
with.

-- 
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/20211021/95f8580a/attachment.html>


More information about the llvm-bugs mailing list