This is an archive of the discontinued LLVM Phabricator instance.

Don't use std::numeric_limits<double>::infinity() as result of function
ClosedPublic

Authored by avt77 on Jul 25 2017, 5:17 AM.

Details

Summary

There is special Optional class which should be used to return invalid numeric value.

Diff Detail

Event Timeline

avt77 created this revision.Jul 25 2017, 5:17 AM
RKSimon added inline comments.Jul 25 2017, 5:48 AM
lib/CodeGen/TargetSchedule.cpp
364

Can Throughput be converted to a Optional<double> and let us get rid of Unknown completely?

avt77 updated this revision to Diff 108272.Jul 26 2017, 7:07 AM

I got rid of "double Unknown = std::numeric_limits<double>::infinity();" - many tnx to Simon for this idea.

RKSimon added inline comments.Jul 26 2017, 7:34 AM
lib/CodeGen/TargetSchedule.cpp
369–376

Remove Cycles and use WPR->Cycles directly (same for above).

if (WPR->Cycles)

and

double Temp = NumUnits * 1.0 / WPR->Cycles;
avt77 updated this revision to Diff 108306.Jul 26 2017, 9:33 AM

The questionn with getCycles() fixed.

This revision is now accepted and ready to land.Jul 26 2017, 10:10 AM
avt77 closed this revision.Jul 28 2017, 6:56 AM

It was committed