On Thu, 2007-01-04 at 10:58 -0800, Chris Lattner wrote:
> There is a typo in the function header (lossleslly) of  
> Type::canLosslesslyBitCastTo:
> 
> 
> // canLosslesllyBitCastTo - Return true if this type can be converted to
> // 'Ty' without any reinterpretation of bits.  For example, uint to int.
> //

Okay.

> 
> >    // At this point we have only various mismatches of the first  
> > class types
> >    // remaining and ptr->ptr. Just select the lossless conversions.  
> > Everything
> >    // else is not lossless.
> 
> This comment needs to be updated.
> 
> > -  switch (getTypeID()) {
> > -  case Type::UByteTyID:   return Ty == Type::SByteTy;
> > -  case Type::SByteTyID:   return Ty == Type::UByteTy;
> > -  case Type::UShortTyID:  return Ty == Type::ShortTy;
> > -  case Type::ShortTyID:   return Ty == Type::UShortTy;
> > -  case Type::UIntTyID:    return Ty == Type::IntTy;
> > -  case Type::IntTyID:     return Ty == Type::UIntTy;
> > -  case Type::ULongTyID:   return Ty == Type::LongTy;
> > -  case Type::LongTyID:    return Ty == Type::ULongTy;
> > -  case Type::PointerTyID: return isa<PointerType>(Ty);
> > -  default:
> > -    break;
> > -  }
> > +  if (getTypeID() == Type::PointerTyID)
> > +    return isa<PointerType>(Ty);
> >    return false;  // Other types have no identity values
> >  }
> 
> What is Type::canLosslesslyBitCastTo used by now?  Can we just  
> eliminate it?

InstCombine. 

> 
> 
> > +FunctionType::ParameterAttributes
> > +FunctionType::getParamAttrs(unsigned Idx) const {
> > +  if (!ParamAttrs)
> > +    return ParameterAttributes(0);
> > +  if (Idx > ParamAttrs->size())
> > +    return ParameterAttributes(0);
> > +  return (*ParamAttrs)[Idx];
> > +}
> 
> Why does this map an out-of-range index onto attr 0?  Shouldn't this  
> be an assert?

No, I'm trying to save space. If you don't set any attributes or don't
set them on all the parameters then it isn't an error, you just get
"none Set". In a subsequent patch I made this clear by returning
NoAttributeSet enum (has value 0).

This saves space by not requiring the ParamAttrs vector to have an entry
for each parameter and not requiring it to even be allocated if there
aren't any parameter attributes.



> 
> -Chris
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to