Handle the case where both operands are negated in matrix multiplication
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1873–1878 | 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. | |
llvm/test/Transforms/InstCombine/matrix-multiplication-negation.ll | ||
126 | Fix test comment. | |
138–150 | Fix test comment. |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1837 | Do we need to handle integers too? (m_Neg) |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1834 | I read "~" as "bitwise not". I expect this comment to be something like this: | |
1838–1839 | The casting is unnecessary, and the code doesn't match the code comment. Capture the source values as "A" and "B" inside the match() statement (the same way it is done in the existing variants of this transform). |
LGTM, with an additional nit. Let's wait a bit with landing in case there are any further comments.
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1833 | nit: comment should be full sentences: capitalize first letter, end with period. |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1833 | According to other comments in the file, that should just be -A * -B -> A * B |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
1833 | The "->" suggestion was not addressed, and we're back to "Optimise" which was requested to be changed/deleted. Also, renaming the operands "NegA" and "NegB" doesn't make things clearer. In the planned next step to this patch, one of those names will be known to be incorrect. The extra words/code are not helping things. Other than that, I have no more comments for this patch. |
nit: comment should be full sentences: capitalize first letter, end with period.