diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-05-08 21:33:47 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-05-08 21:33:47 +0000 | 
| commit | c4f8e2b0ed4d206f5351b2c0a9780955d35d975e (patch) | |
| tree | 29dcf71e6c4e76632dca50eecef658a82b9f7cfb /llvm/lib/Transforms | |
| parent | 877b1140375b135ce866200cf6deecc9da3c6684 (diff) | |
| download | bcm5719-llvm-c4f8e2b0ed4d206f5351b2c0a9780955d35d975e.tar.gz bcm5719-llvm-c4f8e2b0ed4d206f5351b2c0a9780955d35d975e.zip | |
Bail out earlier
llvm-svn: 21786
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 8 | 
1 files changed, 4 insertions, 4 deletions
| diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 69589032264..592df535af7 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -341,10 +341,6 @@ static Value *NegateValue(Value *V, Instruction *BI) {  /// 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 @@ static void PrintOps(unsigned Opcode, const std::vector<ValueEntry> &Ops,  /// 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) { | 

