[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp SlotCalculator.h Writer.cpp

Chris Lattner clattner at apple.com
Fri Jan 12 15:25:03 PST 2007


On Jan 11, 2007, at 11:06 PM, Reid Spencer wrote:
> @@ -484,12 +488,12 @@
>        assert(Slot >= 0 && "No slot number for value!?!?");
>
>        if (isa<SequentialType>(*TI)) {
> -        unsigned IdxId;
> -        switch (I->getOperand(Idx)->getType()->getTypeID()) {
> -        default: assert(0 && "Unknown index type!");
> -        case Type::Int32TyID:  IdxId = 0; break;
> -        case Type::Int64TyID:  IdxId = 1; break;
> -        }
> +        // These should be either 32-bits or 64-bits, however,  
> with bit
> +        // accurate types we just distinguish between less than or  
> equal to
> +        // 32-bits or greater than 32-bits.
> +        const IntegerType *IdxTy =
> +          cast<IntegerType>(I->getOperand(Idx)->getType());
> +        unsigned IdxId = IdxTy->getBitWidth() <= 32 ? 0 : 1;
>          Slot = (Slot << 1) | IdxId;
>        }
>        output_vbr(unsigned(Slot));

This is incorrect.  Please revert it back to checking for 32- and 64- 
bit explicitly.

-Chris



More information about the llvm-commits mailing list