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 | 32fce4d647602e77a68953c08718c4347c2800f3 (patch) | |
tree | 3c7ee2db44e15135170ac079a1c0db523d19aaf7 /llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | |
parent | 1e4643a98e18d2234eecf2f25f396b9cef521b6a (diff) | |
download | bcm5719-llvm-32fce4d647602e77a68953c08718c4347c2800f3.tar.gz bcm5719-llvm-32fce4d647602e77a68953c08718c4347c2800f3.zip |
[InstCombine] Remove support for BITWISE_OP(CONSTANT, BSWAP(x)) -> BSWAP(OP(BSWAP(CONSTANT), x)).
Constants were already canonicalized to the right hand side before we got here.
llvm-svn: 307000
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 9a6199fdafb..5a73eb5cc2f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -85,17 +85,13 @@ Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) { // TODO handle constant on one side with vectors. Value *OldLHS = I.getOperand(0); Value *OldRHS = I.getOperand(1); - ConstantInt *ConstLHS = dyn_cast<ConstantInt>(OldLHS); ConstantInt *ConstRHS = dyn_cast<ConstantInt>(OldRHS); IntrinsicInst *IntrLHS = dyn_cast<IntrinsicInst>(OldLHS); IntrinsicInst *IntrRHS = dyn_cast<IntrinsicInst>(OldRHS); bool IsBswapLHS = (IntrLHS && IntrLHS->getIntrinsicID() == Intrinsic::bswap); bool IsBswapRHS = (IntrRHS && IntrRHS->getIntrinsicID() == Intrinsic::bswap); - if (!IsBswapLHS && !IsBswapRHS) - return nullptr; - - if (!IsBswapLHS && !ConstLHS) + if (!IsBswapLHS) return nullptr; if (!IsBswapRHS && !ConstRHS) @@ -103,8 +99,7 @@ Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) { /// OP( BSWAP(x), BSWAP(y) ) -> BSWAP( OP(x, y) ) /// OP( BSWAP(x), CONSTANT ) -> BSWAP( OP(x, BSWAP(CONSTANT) ) ) - Value *NewLHS = IsBswapLHS ? IntrLHS->getOperand(0) : - Builder->getInt(ConstLHS->getValue().byteSwap()); + Value *NewLHS = IntrLHS->getOperand(0); Value *NewRHS = IsBswapRHS ? IntrRHS->getOperand(0) : Builder->getInt(ConstRHS->getValue().byteSwap()); |