Get the type of a shift from the shift, not from its shift
authorDale Johannesen <dalej@apple.com>
Tue, 21 Dec 2010 20:06:19 +0000 (20:06 +0000)
committerDale Johannesen <dalej@apple.com>
Tue, 21 Dec 2010 20:06:19 +0000 (20:06 +0000)
count operand.  These should be the same but apparently are
not always, and this is cleaner anyway.  This improves the
code in an existing test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122354 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/divide-by-constant.ll

index c58dede823c56023bf8993a70fd3d0633f7ea68e..cd26e647b4341701f785a415af5637125687de26 100644 (file)
@@ -3178,7 +3178,7 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
     uint64_t c1 = 
       cast<ConstantSDNode>(N0.getOperand(0)->getOperand(1))->getZExtValue();
     uint64_t c2 = N1C->getZExtValue();
-    EVT InnerShiftVT = N0.getOperand(0)->getOperand(1).getValueType();
+    EVT InnerShiftVT = N0.getOperand(0).getValueType();
     uint64_t InnerShiftSize = InnerShiftVT.getScalarType().getSizeInBits();
     // This is only valid if the OpSizeInBits + c1 = size of inner shift.
     if (c1 + OpSizeInBits == InnerShiftSize) {
index ab3bd9414957210c92c60948c98f0f477c5a3e20..545662fd0ffc82f4acf97ac5cd52f4a33ddf1bbd 100644 (file)
@@ -29,9 +29,9 @@ entry:
   ret i8 %div
 
 ; CHECK: test3:
-; CHECK: imull $171, %eax, %eax
-; CHECK-NEXT: shrb     %ah
-; CHECK-NEXT: movzbl   %ah, %eax
+; CHECK: movzbl  8(%esp), %eax
+; CHECK-NEXT: imull    $171, %eax, %eax
+; CHECK-NEXT: shrl     $9, %eax
 ; CHECK-NEXT: ret
 }