[PATCH] D133695: [InstCombine] Optimize multiplication where both operands are negated
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 09:15:22 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1876-1881
Value *X, *Y;
if (match(Src0, m_FNeg(m_Value(X))) && match(Src1, m_FNeg(m_Value(Y)))) {
replaceOperand(*II, 0, X);
replaceOperand(*II, 1, Y);
return II;
}
----------------
I commented earlier that we prefer creating a new instruction in transforms like this, but we might as well follow the code structure of this related transform. It doesn't seem to bother the worklist iteration.
================
Comment at: llvm/test/Transforms/InstCombine/matrix-multiplication-negation.ll:126
; both negations will appear on `%b` other passes should optimise ~~b to b
define <9 x double> @test_with_two_operands_negated2(<27 x double> %a, <3 x double> %b){
----------------
Fix test comment.
Add FMF to at least one of these tests, so we can see that those are propagated.
================
Comment at: llvm/test/Transforms/InstCombine/matrix-multiplication-negation.ll:138
; reverse of the previous case both negations should appear on %a
define <9 x double> @test_with_two_operands_negated2_commute(<3 x double> %a, <27 x double> %b){
----------------
Fix test comment.
Add extra uses to at least one of these tests (they should not change the transform).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133695/new/
https://reviews.llvm.org/D133695
More information about the llvm-commits
mailing list