[Matrix] Add optimization remarks for matrix expression.

Authored by fhahn on Jan 27 2020, 4:22 PM.


[Matrix] Add optimization remarks for matrix expression.

Generate remarks for matrix operations in a function. To generate remarks
for matrix expressions, the following approach is used:

  1. Collect leafs of matrix expressions (done in RemarkGenerator::getExpressionLeafs). Leafs are lowered matrix instructions without other matrix users (like stores).
  1. For each leaf, create a remark containing a linearizied version of the matrix expression.

The following improvements will be submitted as follow-ups:

  • Summarize number of vector instructions generated for each expression.
  • Account for shared sub-expressions.
  • Propagate matrix remarks up the inlining chain.

The information provided by the matrix remarks helps users to spot cases
where matrix expression got split up, e.g. due to inlining not
happening. The remarks allow users to address those issues, ensuring
best performance.

Reviewers: anemet, Gerolf, thegameg, hfinkel, andrew.w.kaylor, LuoYuanke

Reviewed By: anemet

Differential Revision: https://reviews.llvm.org/D72453