diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2014-11-14 17:08:15 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2014-11-14 17:08:15 +0000 |
commit | d99df68e19be0c941fb4eff0a18c482a8e4a22f7 (patch) | |
tree | 55ff7eef94db7d1d168a10bed076c61d7bb7a6fa /llvm/lib/Transforms | |
parent | f8b55f1bc5aa5278716a77bcd02915e0d1e757ab (diff) | |
download | bcm5719-llvm-d99df68e19be0c941fb4eff0a18c482a8e4a22f7.tar.gz bcm5719-llvm-d99df68e19be0c941fb4eff0a18c482a8e4a22f7.zip |
[Reassociate] Canonicalize operands of vector binary operators.
Prior to this commit fmul and fadd binary operators were being canonicalized for
both scalar and vector versions. We now canonicalize add, mul, and, or, and xor
vector instructions.
llvm-svn: 222006
Diffstat (limited to 'llvm/lib/Transforms')
-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 42e7aac9d84..67659bb50b0 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()) |