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

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


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:3277
+                                       RetType->getElementCount())) {
+      replaceInstUsesWith(*FNegOp, OpNotNeg);
+      // Insert after call instruction
----------------
I think this is not correct, you are updating all uses of `FNegOp`, but we only have to update the use in the matrix multiply. Can you add a test case where the `FNeg` also has other users in some different instructions? They should remain unchanged.

Also, it would probably make sense to limit this to `fneg` instructions with a single use. If there are other uses outside the multiply, we still need to negate the input and we only add an extra `fneg`.


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