[Reassociate] Canonicalize negative constants out of expressions.

Add support for FDiv, which was regressed by the previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221738 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier
2014-11-11 23:36:42 +00:00
parent a03cda02ab
commit 7ad8db4cbb
2 changed files with 50 additions and 1 deletions

View File

@ -1955,7 +1955,8 @@ Instruction *Reassociate::canonicalizeNegConstExpr(Instruction *I) {
// Must be a mul instruction.
unsigned Opcode = I->getOpcode();
if (Opcode != Instruction::Mul && Opcode != Instruction::FMul)
if (Opcode != Instruction::Mul && Opcode != Instruction::FMul &&
Opcode != Instruction::FDiv)
return nullptr;
// Must have at least one constant operand.