This is an archive of the discontinued LLVM Phabricator instance.

Encapsulate FPOptions and use it consistently
ClosedPublic

Authored by anemet on Mar 20 2017, 8:11 PM.

Details

Summary

Sema holds the current FPOptions which is adjusted by 'pragma STDC
FP_CONTRACT'. This then gets propagated into expression nodes as they are
built.

This encapsulates FPOptions so that this propagation happens opaquely rather
than directly with the fp_contractable on/off bit. This allows controlled
transitioning of fp_contractable to a ternary value (off, on, fast). It will
also allow adding more fast-math flags later.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

Diff Detail

Repository
rL LLVM

Event Timeline

anemet created this revision.Mar 20 2017, 8:11 PM
aaron.ballman added inline comments.Mar 23 2017, 10:38 AM
include/clang/AST/ExprCXX.h
58 ↗(On Diff #92422)

Setting a class to false sounds a bit strange. May want to reword.

include/clang/Basic/LangOptions.h
180 ↗(On Diff #92422)

Why a uint64_t rather than unsigned? Same for the accessor.

182 ↗(On Diff #92422)

Might as well make this one explicit as well.

lib/CodeGen/CGExprScalar.cpp
1712 ↗(On Diff #92422)

Why not make UnaryOperator carry this information now, since it's needed?

anemet marked 3 inline comments as done.Mar 23 2017, 10:30 PM
anemet added inline comments.
lib/CodeGen/CGExprScalar.cpp
1712 ↗(On Diff #92422)

The trouble is that currently it's not needed. I'd rather wait for a fast-math flag that actually needs it so that we can write tests.

anemet updated this revision to Diff 92898.Mar 23 2017, 10:32 PM

Address Aaron's comments.

aaron.ballman accepted this revision.Mar 27 2017, 7:25 AM

LGTM!

lib/CodeGen/CGExprScalar.cpp
1712 ↗(On Diff #92422)

That seems sensible to me, thank you for the explanation.

This revision is now accepted and ready to land.Mar 27 2017, 7:25 AM
This revision was automatically updated to reflect the committed changes.