[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h

Chris Lattner clattner at apple.com
Mon Dec 4 11:15:38 PST 2006


>      Value *visitTruncateExpr(SCEVTruncateExpr *S) {
>        Value *V = expand(S->getOperand());
> -      return CastInst::createInferredCast(V, S->getType(), "tmp.",  
> InsertPt);
> +      Instruction::CastOps Opcode = (V->getType()- 
> >getPrimitiveSizeInBits() ==
> +          S->getType()->getPrimitiveSizeInBits()) ?  
> Instruction::BitCast :
> +          Instruction::Trunc;
> +      return CastInst::create(Opcode, V, S->getType(), "tmp.",  
> InsertPt);
>      }
>
>      Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
>        Value *V = expandInTy(S->getOperand(),S->getType()- 
> >getUnsignedVersion());
> -      return CastInst::createInferredCast(V, S->getType(), "tmp.",  
> InsertPt);
> +      Instruction::CastOps Opcode = (V->getType()- 
> >getPrimitiveSizeInBits() ==
> +          S->getType()->getPrimitiveSizeInBits()) ?  
> Instruction::BitCast :
> +          Instruction::ZExt;
> +      return CastInst::create(Opcode, V, S->getType(), "tmp.",  
> InsertPt);
>      }

These really want CastInst::createZExtOrBitCast methods.

-Chris




More information about the llvm-commits mailing list