diff options
author | Craig Topper <craig.topper@intel.com> | 2017-07-03 05:54:13 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-07-03 05:54:13 +0000 |
commit | 1e4643a98e18d2234eecf2f25f396b9cef521b6a (patch) | |
tree | 408807ffcf9cdb59be6fcf76e68559531644bc3c /llvm/lib/Transforms | |
parent | 960ce1ee204ab999e7e1018e6db76f21132837a0 (diff) | |
download | bcm5719-llvm-1e4643a98e18d2234eecf2f25f396b9cef521b6a.tar.gz bcm5719-llvm-1e4643a98e18d2234eecf2f25f396b9cef521b6a.zip |
[InstCombine] Support BITWISE_OP(BSWAP(A),BSWAP(B))->BSWAP(BITWISE_OP(A, B)) for vectors.
llvm-svn: 306999
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index cb3f3214e99..9a6199fdafb 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -82,12 +82,7 @@ static Value *getFCmpValue(unsigned Code, Value *LHS, Value *RHS, Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) { assert(I.isBitwiseLogicOp() && "Unexpected opcode for bswap simplifying"); - IntegerType *ITy = dyn_cast<IntegerType>(I.getType()); - - // Can't do vectors. - if (I.getType()->isVectorTy()) - return nullptr; - + // TODO handle constant on one side with vectors. Value *OldLHS = I.getOperand(0); Value *OldRHS = I.getOperand(1); ConstantInt *ConstLHS = dyn_cast<ConstantInt>(OldLHS); @@ -115,7 +110,8 @@ Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) { Builder->getInt(ConstRHS->getValue().byteSwap()); Value *BinOp = Builder->CreateBinOp(I.getOpcode(), NewLHS, NewRHS); - Function *F = Intrinsic::getDeclaration(I.getModule(), Intrinsic::bswap, ITy); + Function *F = Intrinsic::getDeclaration(I.getModule(), Intrinsic::bswap, + I.getType()); return Builder->CreateCall(F, BinOp); } |