[all-commits] [llvm/llvm-project] ea21d6: [Matrix] Emit assumption that matrix indices are v...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Sep 22 04:28:43 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea21d688dc0a420b9fc385562a46017fb39b13e5
      https://github.com/llvm/llvm-project/commit/ea21d688dc0a420b9fc385562a46017fb39b13e5
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-09-22 (Wed, 22 Sep 2021)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/test/CodeGen/matrix-type-operators.c
    M clang/test/CodeGenCXX/matrix-type-operators.cpp
    M clang/test/CodeGenObjC/matrix-type-operators.m
    M llvm/include/llvm/IR/MatrixBuilder.h

  Log Message:
  -----------
  [Matrix] Emit assumption that matrix indices are valid.

The matrix extension requires the indices for matrix subscript
expression to be valid and it is UB otherwise.

extract/insertelement produce poison if the index is invalid, which
limits the optimizer to not be bale to scalarize load/extract pairs for
example, which causes very suboptimal code to be generated when using
matrix subscript expressions with variable indices for large matrixes.

This patch updates IRGen to emit assumes to for index expression to
convey the information that the index must be valid.

This also adjusts the order in which operations are emitted slightly, so
indices & assumes are added before the load of the matrix value.

Reviewed By: erichkeane

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




More information about the All-commits mailing list