Page MenuHomePhabricator

Added RAII object for authomatic restore of fp state

Authored by sepavloff on Aug 12 2019, 3:37 AM.



Class IRBuilderBase has now RAII class that helps to restore floating
point options, including default rounding and exceptions modes.

Event Timeline

sepavloff created this revision.Aug 12 2019, 3:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2019, 3:37 AM
kpn added inline comments.Aug 12 2019, 10:11 AM
220 ↗(On Diff #214595)

What does this change give us? Having rmDynamic == 0 means that if a bug causes it to be zero initialized we get the most conservative behavior from the compiler. What's the tradeoff? And where is this change tested?

Looks good to me; I express no opinion about Kevin's question.

sepavloff marked an inline comment as done.Aug 13 2019, 8:52 AM
sepavloff added inline comments.
220 ↗(On Diff #214595)

The intention was to have zero value as the default for RoundingMode, which is used when no constrained operation required. ExceptionBehavior does this: ebIgnore means no special exception behavior is requested. In this case non-zero value indicates that we have to process operation in a special way.

This change is a matter of convenience, it isn't strictly necessary for this patch. If you think it shouldn't go to sources, i'll remove it.

kpn added inline comments.Aug 14 2019, 6:33 AM
220 ↗(On Diff #214595)

Yeah, we're inconsistent. I'd like to resolve that inconsistency another day. Please remove this change.

Updated patch

sepavloff marked 2 inline comments as done.Aug 14 2019, 11:57 PM
sepavloff added inline comments.
220 ↗(On Diff #214595)

OK, remove it.

kpn accepted this revision.Aug 15 2019, 4:34 AM

John already gave his go-ahead, and I'm adding my LGTM.

This revision is now accepted and ready to land.Aug 15 2019, 4:34 AM