This is an archive of the discontinued LLVM Phabricator instance.

[POC][RISCV] Take into account instruction compressibility in materialization cost

Authored by luismarques on Jul 19 2021, 2:55 PM.



This patch is currently only meant to illustrate a possible approach to address a constant materialization regression in D105417, etc. It takes the D105417 patch and adds the getInstSeqCost function I was using in an old (unpublished) constant materialization patch.


  • To better illustrate the original implementation, I kept the boolean HasRVC and OptSize parameters in getInstSeqCost. But they aren't actually being used in this patch. The tests generally don't have the C extension, so without additional test changes you wouldn't see any difference. Keeping those changes out of this patch makes the differences more obvious, IMO. Plugging the size optimization flag is also not quite trivial, and would further obscure the test differences.
  • I also used getInstSeqCost in the generateInstSeqImpl tentative optimizations, to illustrate how I was originally using this function. To address the isDesirableToCommuteWithShift-related regression it only needs to be used in getIntMatCost, though.

Diff Detail