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

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 27 03:50:47 PDT 2021


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/include/llvm/IR/MatrixBuilder.h:242
+    auto *Cmp = B.CreateICmpULT(Idx, NumElts);
+    if (!isa<llvm::ConstantInt>(Cmp)) {
+      Function *TheFn =
----------------
rjmccall wrote:
> xbolva00 wrote:
> > Prefer early exit?
> Should this do something special if the index is statically out of bounds?
I think this cause should never happen and if it does it means earlier checks have been missed. I added an assert.


================
Comment at: llvm/include/llvm/IR/MatrixBuilder.h:245
+          Intrinsic::getDeclaration(getModule(), Intrinsic::assume);
+      B.CreateCall(TheFn->getFunctionType(), TheFn, {Cmp}, Name);
+    }
----------------
xbolva00 wrote:
> B.CreateAssumption(Cmp) may work well as well? and shorter.
Updated, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102478/new/

https://reviews.llvm.org/D102478



More information about the cfe-commits mailing list