[llvm] r219884 - Revert r219832.

David Blaikie dblaikie at gmail.com
Wed Oct 15 18:31:26 PDT 2014


Its helpful to mention why you're reverting a patch in the commit message
(in case someone is trying to track down issues or maybe later on try to
make a similar change)
On Oct 15, 2014 6:28 PM, "Akira Hatanaka" <ahatanaka at apple.com> wrote:

> Author: ahatanak
> Date: Wed Oct 15 20:17:02 2014
> New Revision: 219884
>
> URL: http://llvm.org/viewvc/llvm-project?rev=219884&view=rev
> Log:
> Revert r219832.
>
> Removed:
>     llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll
> Modified:
>     llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=219884&r1=219883&r2=219884&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Wed Oct
> 15 20:17:02 2014
> @@ -2075,37 +2075,6 @@ Instruction *InstCombiner::visitBranchIn
>
>  Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
>    Value *Cond = SI.getCondition();
> -  unsigned BitWidth = cast<IntegerType>(Cond->getType())->getBitWidth();
> -  APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
> -  computeKnownBits(Cond, KnownZero, KnownOne);
> -  unsigned LeadingKnownZeros = KnownZero.countLeadingOnes();
> -  unsigned LeadingKnownOnes = KnownOne.countLeadingOnes();
> -
> -  // Compute the number of leading bits we can ignore.
> -  for (auto &C : SI.cases()) {
> -    LeadingKnownZeros = std::min(
> -        LeadingKnownZeros,
> C.getCaseValue()->getValue().countLeadingZeros());
> -    LeadingKnownOnes = std::min(
> -        LeadingKnownOnes,
> C.getCaseValue()->getValue().countLeadingOnes());
> -  }
> -
> -  unsigned NewWidth = BitWidth - std::max(LeadingKnownZeros,
> LeadingKnownOnes);
> -
> -  // Truncate the condition operand if the new type is equal to or larger
> than
> -  // the largest legal integer type. We need to be conservative here since
> -  // x86 generates redundant zero-extenstion instructions if the operand
> is
> -  // truncated to i8 or i16.
> -  if (BitWidth > NewWidth && NewWidth >=
> DL->getLargestLegalIntTypeSize()) {
> -    IntegerType *Ty = IntegerType::get(SI.getContext(), NewWidth);
> -    Builder->SetInsertPoint(&SI);
> -    Value *NewCond = Builder->CreateTrunc(SI.getCondition(), Ty, "trunc");
> -    SI.setCondition(NewCond);
> -
> -    for (auto &C : SI.cases())
> -      static_cast<SwitchInst::CaseIt *>(&C)->setValue(
> -          ConstantInt::get(Ty,
> C.getCaseValue()->getValue().getZExtValue()));
> -  }
> -
>    if (Instruction *I = dyn_cast<Instruction>(Cond)) {
>      if (I->getOpcode() == Instruction::Add)
>        if (ConstantInt *AddRHS = dyn_cast<ConstantInt>(I->getOperand(1))) {
>
> Removed: llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll?rev=219883&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll (removed)
> @@ -1,61 +0,0 @@
> -; RUN: opt < %s -instcombine -S | FileCheck %s
> -
> -target datalayout =
> "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
> -
> -; CHECK-LABEL: define i32 @positive1
> -; CHECK: switch i32
> -; CHECK: i32 10, label
> -; CHECK: i32 100, label
> -; CHECK: i32 1001, label
> -
> -define i32 @positive1(i64 %a) {
> -entry:
> -  %and = and i64 %a, 4294967295
> -  switch i64 %and, label %sw.default [
> -    i64 10, label %return
> -    i64 100, label %sw.bb1
> -    i64 1001, label %sw.bb2
> -  ]
> -
> -sw.bb1:
> -  br label %return
> -
> -sw.bb2:
> -  br label %return
> -
> -sw.default:
> -  br label %return
> -
> -return:
> -  %retval.0 = phi i32 [ 24, %sw.default ], [ 123, %sw.bb2 ], [ 213,
> %sw.bb1 ], [ 231, %entry ]
> -  ret i32 %retval.0
> -}
> -
> -; CHECK-LABEL: define i32 @negative1
> -; CHECK: switch i32
> -; CHECK: i32 -10, label
> -; CHECK: i32 -100, label
> -; CHECK: i32 -1001, label
> -
> -define i32 @negative1(i64 %a) {
> -entry:
> -  %or = or i64 %a, -4294967296
> -  switch i64 %or, label %sw.default [
> -    i64 -10, label %return
> -    i64 -100, label %sw.bb1
> -    i64 -1001, label %sw.bb2
> -  ]
> -
> -sw.bb1:
> -  br label %return
> -
> -sw.bb2:
> -  br label %return
> -
> -sw.default:
> -  br label %return
> -
> -return:
> -  %retval.0 = phi i32 [ 24, %sw.default ], [ 123, %sw.bb2 ], [ 213,
> %sw.bb1 ], [ 231, %entry ]
> -  ret i32 %retval.0
> -}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141015/f0f76455/attachment.html>


More information about the llvm-commits mailing list