[llvm] r310064 - [InstCombine] Fold single-use variable into assert.

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 09:11:43 PDT 2017


Thanks! I was just about to commit the identical patch.

On Fri, Aug 4, 2017 at 10:08 AM, Benjamin Kramer via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: d0k
> Date: Fri Aug  4 09:08:41 2017
> New Revision: 310064
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310064&view=rev
> Log:
> [InstCombine] Fold single-use variable into assert.
>
> Avoids unused variable warnings in Release builds. No functional change.
>
> Modified:
>     llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Transforms/InstCombine/InstCombineShifts.cpp?rev=
> 310064&r1=310063&r2=310064&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp Fri Aug
> 4 09:08:41 2017
> @@ -682,8 +682,8 @@ Instruction *InstCombiner::visitLShr(Bin
>
>      if (match(Op0, m_OneUse(m_ZExt(m_Value(X)))) &&
>          (!Ty->isIntegerTy() || shouldChangeType(Ty, X->getType()))) {
> -      unsigned SrcTyBitWidth = X->getType()->getScalarSizeInBits();
> -      assert(ShAmt < SrcTyBitWidth && "Big shift not simplified to
> zero?");
> +      assert(ShAmt < X->getType()->getScalarSizeInBits() &&
> +             "Big shift not simplified to zero?");
>        // lshr (zext iM X to iN), C --> zext (lshr X, C) to iN
>        Value *NewLShr = Builder.CreateLShr(X, ShAmt);
>        return new ZExtInst(NewLShr, Ty);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170804/bccab716/attachment.html>


More information about the llvm-commits mailing list