This is an archive of the discontinued LLVM Phabricator instance.

[APFloat] Remove dead store in the move constructor of IEEEFloat
AbandonedPublic

Authored by vgao on Aug 20 2018, 2:53 PM.

Details

Summary

In the move constructor, field semantics is first set to &semBogus, which is a static constant.
It is then set to rhs.semantics, killing the first store. This dead store is not removed in -O3.

freeSignificand() is called between the two stores, and it does read from the field semantics. However with semantics set to &semBogus, this operation always evaluates to nothing.

This diff adds a helper function (moveFields) that copies the fields without calling freeSignificand().
By doing this we save a store (and potentially a call to freeSignicand()) in IEEEFloat(IEEEFloat &&), and do not lose any performance in operator =(IEEEFloat &&), since moveFields is inlined in both callsites.

Diff Detail

Repository
rL LLVM

Event Timeline

vgao created this revision.Aug 20 2018, 2:53 PM
vgao edited the summary of this revision. (Show Details)Aug 20 2018, 2:54 PM
vgao updated this revision to Diff 161573.Aug 20 2018, 3:01 PM

fix path

vgao abandoned this revision.Aug 20 2018, 3:13 PM