* Remove dead variable
authorChris Lattner <sabre@nondot.org>
Sat, 2 Nov 2002 00:44:25 +0000 (00:44 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 2 Nov 2002 00:44:25 +0000 (00:44 +0000)
* Shift amount is always guaranteed to be 8 bits

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

lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp

index 7e4f689fe2abd8ab259dfc5278b4926cfdc04d97..65a7e6798360aaf1319397e82e3ad080c2e9dc73 100644 (file)
@@ -153,14 +153,16 @@ ISel::visitShiftInst (ShiftInst & I)
 {
   unsigned Op0r = getReg (I.getOperand (0));
   unsigned DestReg = getReg (I);
-  unsigned operandSize = I.getOperand (0)->getType ()->getPrimitiveSize ();
+  unsigned operandSize = I.getType ()->getPrimitiveSize ();
   bool isRightShift = (I.getOpcode () == Instruction::Shr);
   bool isOperandUnsigned = I.getType ()->isUnsigned ();
-  bool isConstantShiftAmount = (isa <ConstantUInt> (I.getOperand (1)));
+
   if (ConstantUInt *CUI = dyn_cast <ConstantUInt> (I.getOperand (1)))
     {
-      // The shift amount is constant. Get its value.
-      uint64_t shAmt = CUI->getValue ();
+      // The shift amount is constant, guaranteed to be a ubyte. Get its value.
+      assert(CUI->getType() == Type::UByteTy && "Shift amount not a ubyte?");
+      unsigned char shAmt = CUI->getValue();
+
       // Emit: <insn> reg, shamt  (shift-by-immediate opcode "ir" form.)
       if (isRightShift)
        {
index 7e4f689fe2abd8ab259dfc5278b4926cfdc04d97..65a7e6798360aaf1319397e82e3ad080c2e9dc73 100644 (file)
@@ -153,14 +153,16 @@ ISel::visitShiftInst (ShiftInst & I)
 {
   unsigned Op0r = getReg (I.getOperand (0));
   unsigned DestReg = getReg (I);
-  unsigned operandSize = I.getOperand (0)->getType ()->getPrimitiveSize ();
+  unsigned operandSize = I.getType ()->getPrimitiveSize ();
   bool isRightShift = (I.getOpcode () == Instruction::Shr);
   bool isOperandUnsigned = I.getType ()->isUnsigned ();
-  bool isConstantShiftAmount = (isa <ConstantUInt> (I.getOperand (1)));
+
   if (ConstantUInt *CUI = dyn_cast <ConstantUInt> (I.getOperand (1)))
     {
-      // The shift amount is constant. Get its value.
-      uint64_t shAmt = CUI->getValue ();
+      // The shift amount is constant, guaranteed to be a ubyte. Get its value.
+      assert(CUI->getType() == Type::UByteTy && "Shift amount not a ubyte?");
+      unsigned char shAmt = CUI->getValue();
+
       // Emit: <insn> reg, shamt  (shift-by-immediate opcode "ir" form.)
       if (isRightShift)
        {