diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2008-05-23 04:34:58 +0000 | 
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2008-05-23 04:34:58 +0000 | 
| commit | 4f3d878507e3012e6417c7c742f4e22e7ed51fb2 (patch) | |
| tree | ce63f2686dc86a749244ea873af19548fa995987 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | 3546c2b4e421a76d8a17c814f6b0d77b1c9f4792 (diff) | |
| download | bcm5719-llvm-4f3d878507e3012e6417c7c742f4e22e7ed51fb2.tar.gz bcm5719-llvm-4f3d878507e3012e6417c7c742f4e22e7ed51fb2.zip | |
Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.
llvm-svn: 51474
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 18 | 
1 files changed, 5 insertions, 13 deletions
| diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 1a878681056..655ca4b0a66 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2292,22 +2292,14 @@ static Instruction *AssociativeOpt(BinaryOperator &Root, const Functor &F) {  namespace { -// AddRHS - Implements: X + X --> X << 1 and X + X --> X * 2 for vectors +// AddRHS - Implements: X + X --> X << 1  struct AddRHS {    Value *RHS;    AddRHS(Value *rhs) : RHS(rhs) {}    bool shouldApply(Value *LHS) const { return LHS == RHS; }    Instruction *apply(BinaryOperator &Add) const { -    if (Add.getType()->getTypeID() == Type::VectorTyID) { -      const VectorType *VTy = cast<VectorType>(Add.getType()); -      ConstantInt *CI = ConstantInt::get(VTy->getElementType(), 2); -      std::vector<Constant*> Elts(VTy->getNumElements(), CI); -      return BinaryOperator::CreateMul(Add.getOperand(0), -                                       ConstantVector::get(Elts)); -    } else { -      return BinaryOperator::CreateShl(Add.getOperand(0), -                                       ConstantInt::get(Add.getType(), 1)); -    } +    return BinaryOperator::CreateShl(Add.getOperand(0), +                                     ConstantInt::get(Add.getType(), 1));    }  }; @@ -2635,8 +2627,8 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {      }    } -  // X + X --> X << 1 and X + X --> X * 2 for vectors -  if (I.getType()->isIntOrIntVector() && I.getType() != Type::Int1Ty) { +  // X + X --> X +  if (I.getType()->isInteger() && I.getType() != Type::Int1Ty) {      if (Instruction *Result = AssociativeOpt(I, AddRHS(RHS))) return Result;      if (Instruction *RHSI = dyn_cast<Instruction>(RHS)) { | 

