[PATCH] Remove dead code in instcombine.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Apr 22 15:16:29 PDT 2014


What about an assert then?

On 14 April 2014 18:10, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:
> Don't replace shifts greater than the type with the maximum shift.
>
> This isn't hit anywhere in the tests, and somewhere else is replacing these with undef.
>
> 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
> @@ -340,17 +340,6 @@
>    // 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;
> -  }
> -
>    // ((X*C1) << C2) == (X * (C1 << C2))
>    if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op0))
>      if (BO->getOpcode() == Instruction::Mul && isLeftShift)
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list