[PATCH] Remove dead code in instcombine.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Apr 23 04:42:14 PDT 2014


LGTM

On 22 April 2014 18:53, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:
> Add assert. I don't think this is really necessary since I don't think anything after this would actually break if it were true.
>
> CHANGES SINCE LAST UPDATE
>   http://reviews.llvm.org/D3371?vs=8512&id=8752
>
> http://reviews.llvm.org/D3371
>
> Files:
>   lib/Transforms/InstCombine/InstCombineShifts.cpp
>
> Index: lib/Transforms/InstCombine/InstCombineShifts.cpp
> ===================================================================
> --- lib/Transforms/InstCombine/InstCombineShifts.cpp
> +++ lib/Transforms/InstCombine/InstCombineShifts.cpp
> @@ -337,21 +337,12 @@
>                   GetShiftedValue(Op0, COp1->getZExtValue(), isLeftShift, *this));
>    }
>
> -
>    // See if we can simplify any instructions used by the instruction whose sole
>    // purpose is to compute bits we don't care about.
>    uint32_t TypeBits = Op0->getType()->getScalarSizeInBits();
>
> -  // shl i32 X, 32 = 0 and srl i8 Y, 9 = 0, ... just don't eliminate
> -  // a signed shift.
> -  //
> -  if (COp1->uge(TypeBits)) {
> -    if (I.getOpcode() != Instruction::AShr)
> -      return ReplaceInstUsesWith(I, Constant::getNullValue(Op0->getType()));
> -    // ashr i32 X, 32 --> ashr i32 X, 31
> -    I.setOperand(1, ConstantInt::get(I.getType(), TypeBits-1));
> -    return &I;
> -  }
> +  assert(!COp1->uge(TypeBits) &&
> +         "Shift over the type width should have been removed already");
>
>    // ((X*C1) << C2) == (X * (C1 << C2))
>    if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op0))
>
> REPLY HANDLER ACTIONS
>   Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe.



More information about the llvm-commits mailing list