[InstCombine] canonicalize MUL with NEG operand
authorChen Zheng <czhengsz@cn.ibm.com>
Tue, 1 Jan 2019 01:09:20 +0000 (01:09 +0000)
committerChen Zheng <czhengsz@cn.ibm.com>
Tue, 1 Jan 2019 01:09:20 +0000 (01:09 +0000)
commit4952e668f8e525820bb59ea78c1e5eeea3da68fe
tree350c039f660453b815d467a7496646b365d06d02
parent745983ba0ed8a2a8bbd8b75beaa9f3a4a02dad95
[InstCombine] canonicalize MUL with NEG operand

-X * Y --> -(X * Y)
X * -Y --> -(X * Y)

Differential Revision: https://reviews.llvm.org/D55961

llvm-svn: 350185
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/mul.ll
llvm/test/Transforms/InstCombine/operand-complexity.ll