This is an archive of the discontinued LLVM Phabricator instance.

Avoid creating a Constant for each value in a ConstantDataSequential.
ClosedPublic

Authored by asbirlea on Mar 8 2018, 2:44 PM.

Details

Summary

We create a ConstantDataSequential (ConstantDataArray or ConstantDataVector) to avoid creating a Constant for each element in an array of constants. But them in AsmPrinter, we do create a ConstantFP for each element in the ConstantDataSequential. This triggers excessive memory use when generating large global FP constants.

Diff Detail

Repository
rL LLVM

Event Timeline

asbirlea created this revision.Mar 8 2018, 2:44 PM
bogner accepted this revision.Mar 8 2018, 4:00 PM

Seems straightforward enough. LGTM.

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
2130–2131 ↗(On Diff #137660)

I'm not sure the "FromAPFloat" adds much here, maybe we should just overload emitGlobalConstantFP?

This revision is now accepted and ready to land.Mar 8 2018, 4:00 PM
asbirlea updated this revision to Diff 137671.Mar 8 2018, 4:24 PM

Address comment.
Thank you very much for the review!

This revision was automatically updated to reflect the committed changes.