diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 42e7aac..67659bb 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -2083,14 +2083,9 @@ void Reassociate::OptimizeInst(Instruction *I) { // writing other transformations simpler. if (I->getType()->isFloatingPointTy() || I->getType()->isVectorTy()) { - // FAdd and FMul can be commuted. - unsigned Opcode = I->getOpcode(); - if (Opcode == Instruction::FMul || Opcode == Instruction::FAdd) + if (I->isCommutative()) canonicalizeOperands(I); - // FIXME: We should commute vector instructions as well. However, this - // requires further analysis to determine the effect on later passes. - // Don't try to optimize vector instructions or anything that doesn't have // unsafe algebra. if (I->getType()->isVectorTy() || !I->hasUnsafeAlgebra()) |