[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Reid Spencer reid at x10sys.com
Tue Dec 5 11:58:10 PST 2006


On Tue, 2006-12-05 at 11:52 -0800, Chris Lattner wrote:
> >  SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type  
> > *Ty) {
> >    if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
> > -    return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(),  
> > Ty));
> > +    return SCEVUnknown::get(
> > +        ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
> 
> Shouldn't this one always bit a truncate?

No, they could be the same size.

> 
> >  SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const  
> > Type *Ty) {
> >    if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
> > -    return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(),  
> > Ty));
> > +    return SCEVUnknown::get(
> > +        ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
> 
> Likewise, always a zext?

No, they could be the same size.

> 
> > @@ -998,11 +1000,10 @@
> >        Constant *LHSCV = LHSC->getValue();
> >        Constant *RHSCV = RHSC->getValue();
> >        if (LHSCV->getType()->isUnsigned())
> > -        LHSCV = ConstantExpr::getInferredCast(
> > -            LHSCV, false, LHSCV->getType()->getSignedVersion(),  
> > true);
> > +        LHSCV = ConstantExpr::getBitCast(LHSCV,
> > +                                         LHSCV->getType()- 
> > >getSignedVersion());
> >        if (RHSCV->getType()->isUnsigned())
> > -        RHSCV = ConstantExpr::getInferredCast(
> > -            RHSCV, false, LHSCV->getType(), true);
> > +        RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
> >        return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
> >      }
> >    }
> 
> As I mentioned before, these casts can all go away.  sdiv is signless  
> now.

One thing at a time.  This patch is getting rid of getInferredCast and
no more.

> 
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061205/4e29c758/attachment.sig>


More information about the llvm-commits mailing list