Skip to content

Fast Math Flags not propagated to phis/select instructions #51601

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 52259
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @andykaylor,@davidbolvansky,@jyknight,@RKSimon,@rotateright

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions