[llvm-commits] CVS: llvm/lib/Transforms/Scalar/Reassociate.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun May 8 14:34:01 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
Reassociate.cpp updated: 1.46 -> 1.47
---
Log message:
Bail out earlier
---
Diffs of the changes: (+4 -4)
Reassociate.cpp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.46 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.47
--- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.46 Sun May 8 16:28:52 2005
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp Sun May 8 16:33:47 2005
@@ -341,10 +341,6 @@
/// only used by an add, transform this into (X+(0-Y)) to promote better
/// reassociation.
static Instruction *BreakUpSubtract(Instruction *Sub) {
- // Reject cases where it is pointless to do this.
- if (Sub->getType()->isFloatingPoint())
- return 0; // Floating point adds are not associative.
-
// Don't bother to break this up unless either the LHS is an associable add or
// if this is only used by one.
if (!isReassociableOp(Sub->getOperand(0), Instruction::Add) &&
@@ -560,6 +556,10 @@
/// reassociating them as we go.
void Reassociate::ReassociateBB(BasicBlock *BB) {
for (BasicBlock::iterator BI = BB->begin(); BI != BB->end(); ++BI) {
+ // Reject cases where it is pointless to do this.
+ if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint())
+ continue; // Floating point ops are not associative.
+
// If this is a subtract instruction which is not already in negate form,
// see if we can convert it to X+-Y.
if (BI->getOpcode() == Instruction::Sub) {
More information about the llvm-commits
mailing list