[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 10 17:24:02 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.76 -> 1.77

---
Log message:

Implement: -A*-B == A*B


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.76 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.77
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.76	Mon Mar 10 17:13:59 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Mar 10 17:23:04 2003
@@ -342,6 +342,10 @@
     }
   }
 
+  if (Value *Op0v = dyn_castNegVal(Op0))     // -X * -Y = X*Y
+    if (Value *Op1v = dyn_castNegVal(I.getOperand(1)))
+      return BinaryOperator::create(Instruction::Mul, Op0v, Op1v);
+
   return Changed ? &I : 0;
 }
 





More information about the llvm-commits mailing list