This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add RISCV-specific TargetTransformInfo
AbandonedPublic

Authored by lenary on Jun 7 2019, 8:07 AM.

Details

Reviewers
asb
luismarques
Summary

LLVM Allows Targets to provide information that guides optimisations
made to LLVM IR. This is done with callbacks on a TargetTransformInfo object.

This patch adds a TargetTransformInfo class for RISC-V. This will allow us to
implement RISC-V specific callbacks as they become necessary.

This commit also adds the getIntImmCost callbacks, and tests them with a simple
constant hoisting test.

Event Timeline

lenary created this revision.Jun 7 2019, 8:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2019, 8:07 AM
asb added inline comments.Jun 7 2019, 11:43 PM
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
17

Don't you want to implement this in terms of getIntMatCost, as you introduced in D62857?

lenary marked an inline comment as done.Jun 17 2019, 1:14 AM
lenary added inline comments.
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
17

I felt that was:

  • less clear;
  • less easy to customise, for other LLVM IR instructions with constant arguments that might mean other things; and
  • obscured the fact that getIntImmCost is an estimate, where the code that uses the result has fairly specific "thresholds" that trigger optimisation behaviour.

I felt these three points outweighed the abstraction benefits of calling getIntMatCost.

MaskRay added inline comments.
llvm/test/Transforms/ConstantHoisting/RISCV/lit.local.cfg
3

Delete the empty line... No need to copy it from X86 :)

lenary updated this revision to Diff 205077.Jun 17 2019, 8:17 AM
  • Address review feedback
lenary abandoned this revision.Jun 17 2019, 8:25 AM

I attempted to update this diff, but with a rebased branch arc didn't cope. Starting again.