This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] propagate fast-math-flags (FMF) from phi to select
ClosedPublic

Authored by spatel on Nov 13 2019, 2:02 PM.

Details

Summary

This is another step towards having FMF apply only to FP values rather than those + fcmp. See PR38086 for one of the original discussions/motivations:
https://bugs.llvm.org/show_bug.cgi?id=38086

And the test here is derived from PR39535:
https://bugs.llvm.org/show_bug.cgi?id=39535

Currently, we lose FMF when converting any phi to select in SimplifyCFG. There are a small number of similar changes needed to correct within SimplifyCFG, so it should be quick to patch this pass up.

FMF was extended to select and phi with:
D61917
D67564

Diff Detail

Event Timeline

spatel created this revision.Nov 13 2019, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2019, 2:02 PM
cameron.mcinally accepted this revision.Nov 14 2019, 8:46 AM

LGTM

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
1416

Have we considered adding a CreateSelectFMF(...)? It could be a little weird though, since CreateSelect(...) handles both Int and FP...

This revision is now accepted and ready to land.Nov 14 2019, 8:46 AM
spatel marked an inline comment as done.Nov 15 2019, 9:54 AM
spatel added inline comments.
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
1416

I hadn't thought of that, but that's a possibility. We could assert that if an optional FMF was passed to the builder as a parameter that the select actually is an FPMathOperator.

This revision was automatically updated to reflect the committed changes.