This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Don't promote constants with float ConstantExpr.
ClosedPublic

Authored by fhahn on May 13 2020, 7:58 AM.

Details

Summary

Currently the AsmPrinter cannot emit some floating point constant
expressions in global initializers. Avoid generating them.

Diff Detail

Event Timeline

fhahn created this revision.May 13 2020, 7:58 AM
fhahn updated this revision to Diff 263730.May 13 2020, 8:11 AM

Simplify code.

efriedma added inline comments.May 13 2020, 10:19 AM
llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
567–570

I would rather extend the check here to make it recursive: in addition to restricting ConstantExprs, restrict ConstantAggregates that contain a ConstantExpr or GlobalValue. Or just call Constant::needsRelocation().

fhahn updated this revision to Diff 263849.May 13 2020, 2:04 PM

Update to disallow any constant expressions, global values or blockvalues.

fhahn marked an inline comment as done.May 13 2020, 2:05 PM
fhahn added inline comments.
llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
567–570

Done, I've changed containsFloatConstantExpr to containsOnlyConstantData which traverses ConstantAggregates.

This revision is now accepted and ready to land.May 13 2020, 2:28 PM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.May 13 2020, 4:44 PM

Thanks Eli!