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