[PATCH] D102478: [Matrix] Emit assumption that matrix indices are valid.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 04:09:34 PDT 2021


fhahn created this revision.
fhahn added reviewers: rjmccall, anemet, rsmith, erichkeane.
Herald added subscribers: dexonsmith, tschuett.
fhahn requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102478

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102478.345393.patch
Type: text/x-patch
Size: 18825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210514/3bd7b478/attachment.bin>


More information about the llvm-commits mailing list