[PATCH] D133300: [InstCombine] Matrix multiplication negation optimisation

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 05:33:05 PDT 2022


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:74
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
----------------
Why is this needed?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:3235
+    // Case 1: the operand has the smalest element count i.e
+    // A.neg = ~A
+    // A.neg * B = C
----------------
here it should be sufficient to use a more compact mathematical notation: `(-A) * B = -(A * B)`


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:3266
+    Value *OpNotNeg = FNegOp->getOperand(0);
+    VectorType *FNegType = dyn_cast<VectorType>(FNegOp->getType());
+    VectorType *SecondOperandType =
----------------
can use `cast` here if you are not checking if `FNegType` is null. Same for similar uses uses of `dyn_cast`  here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133300



More information about the llvm-commits mailing list