diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-08-16 23:36:28 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-08-16 23:36:28 +0000 |
commit | a53ad0e157d19487e2baab9e7bd02bdf1e353782 (patch) | |
tree | 69e8527588c1c2ce5c204ce5acd0cf1ad84bab77 /llvm/lib | |
parent | 16fa8b09702378bacfa3d07081afe6b353b99e60 (diff) | |
download | bcm5719-llvm-a53ad0e157d19487e2baab9e7bd02bdf1e353782.tar.gz bcm5719-llvm-a53ad0e157d19487e2baab9e7bd02bdf1e353782.zip |
Revert r367891 - "[InstCombine] combine mul+shl separated by zext"
This reverts commit 5dbb90bfe14ace30224239cac7c61a1422fa5144.
As noted in the post-commit thread for r367891, this can create
a multiply that is lowered to a libcall that may not exist.
We need to improve the backend decomposition for integer multiply
before trying to re-land this (if it's still worthwhile after
doing the backend work).
llvm-svn: 369174
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index db6e4951a7a..2891edd4502 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -763,25 +763,14 @@ Instruction *InstCombiner::visitShl(BinaryOperator &I) { unsigned ShAmt = ShAmtAPInt->getZExtValue(); unsigned BitWidth = Ty->getScalarSizeInBits(); + // shl (zext X), ShAmt --> zext (shl X, ShAmt) + // This is only valid if X would have zeros shifted out. Value *X; if (match(Op0, m_OneUse(m_ZExt(m_Value(X))))) { unsigned SrcWidth = X->getType()->getScalarSizeInBits(); - // shl (zext X), ShAmt --> zext (shl X, ShAmt) - // This is only valid if X would have zeros shifted out. if (ShAmt < SrcWidth && MaskedValueIsZero(X, APInt::getHighBitsSet(SrcWidth, ShAmt), 0, &I)) return new ZExtInst(Builder.CreateShl(X, ShAmt), Ty); - - // shl (zext (mul MulOp, C2)), ShAmt --> mul (zext MulOp), (C2 << ShAmt) - // This is valid if the high bits of the wider multiply are shifted out. - Value *MulOp; - const APInt *C2; - if (ShAmt >= (BitWidth - SrcWidth) && - match(X, m_Mul(m_Value(MulOp), m_APInt(C2)))) { - Value *Zext = Builder.CreateZExt(MulOp, Ty); - Constant *NewMulC = ConstantInt::get(Ty, C2->zext(BitWidth).shl(ShAmt)); - return BinaryOperator::CreateMul(Zext, NewMulC); - } } // (X >> C) << C --> X & (-1 << C) |