[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner clattner at apple.com
Wed Dec 13 09:53:53 PST 2006


> Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
> diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567  
> llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568
> --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567	Wed  
> Dec 13 02:27:15 2006
> +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Dec 13  
> 02:33:33 2006
> @@ -2172,11 +2172,13 @@
>    // formed.
>    CastInst *BoolCast = 0;
>    if (CastInst *CI = dyn_cast<CastInst>(I.getOperand(0)))
> -    if (CI->getOperand(0)->getType() == Type::BoolTy)
> +    if (CI->getOperand(0)->getType() == Type::BoolTy &&
> +        CI->getOpcode() == Instruction::ZExt)
>        BoolCast = CI;
>    if (!BoolCast)
>      if (CastInst *CI = dyn_cast<CastInst>(I.getOperand(1)))
> -      if (CI->getOperand(0)->getType() == Type::BoolTy)
> +      if (CI->getOperand(0)->getType() == Type::BoolTy &&
> +        CI->getOpcode() == Instruction::ZExt)
>          BoolCast = CI;
>    if (BoolCast) {
>      if (SetCondInst *SCI = dyn_cast<SetCondInst>(BoolCast- 
> >getOperand(0))) {

Why not dyn_cast<ZExtInst> instead of checking the opcode?

Thanks Reid,

-Chris



More information about the llvm-commits mailing list