+ uint32_t W = VR.typeToWidth(DestTy);
+ Value *TheCI = IG.canonicalize(CI, Top);
+ ConstantRange CR = VR.rangeFromValue(Op, Top, W);
+
+ if (!CR.isFullSet()) {
+ switch (Opcode) {
+ default: break;
+ case Instruction::ZExt:
+ VR.applyRange(TheCI, CR.zeroExtend(W), Top, this);
+ break;
+ case Instruction::SExt:
+ VR.applyRange(TheCI, CR.signExtend(W), Top, this);
+ break;
+ case Instruction::Trunc: {
+ ConstantRange Result = CR.truncate(W);
+ if (!Result.isFullSet())
+ VR.applyRange(TheCI, Result, Top, this);
+ } break;
+ case Instruction::BitCast:
+ VR.applyRange(TheCI, CR, Top, this);
+ break;
+ // TODO: other casts?
+ }
+ }