[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 1 18:45:01 PST 2002


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.11 -> 1.12

---
Log message:

* Remove dead variable
* Shift amount is always guaranteed to be 8 bits


---
Diffs of the changes:

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.11 llvm/lib/Target/X86/InstSelectSimple.cpp:1.12
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.11	Thu Oct 31 17:03:59 2002
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Fri Nov  1 18:44:25 2002
@@ -153,14 +153,16 @@
 {
   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)
 	{





More information about the llvm-commits mailing list