This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Invert CSEL predicates if the opposite is a simpler constant to materialise
ClosedPublic

Authored by dmgreen on Aug 24 2019, 3:54 AM.

Details

Summary

This moves ConstantMaterializationCost into ARMBaseInstrInfo so that it can also be used in ISel Lowering, adding codesize values to the computed costs, to be able to compare either approximate instruction counts or codesize costs.

It also adds a HasLowerConstantMaterializationCost, which compares the ConstantMaterializationCost of two values, returning true if the first is smaller either in instruction count/codesize, or falling back to the other in the case that they are equal.

This is used in constant CSEL lowering to invert the predicate if the opposite is easier to materialise.

Diff Detail

Repository
rL LLVM

Event Timeline

dmgreen created this revision.Aug 24 2019, 3:54 AM
samparker accepted this revision.Sep 2 2019, 7:58 AM

And I thought that I had already move this into ARMISelLowering... LGTM.

This revision is now accepted and ready to land.Sep 2 2019, 7:58 AM
This revision was automatically updated to reflect the committed changes.