| 169 | } |
| 170 | |
| 171 | Value *adapt(Value *Val, Type *Ty, const Twine &Name = Twine()) { |
| 172 | if (C.choose(15) == 0) |
| 173 | Val = new FreezeInst(Val, "", BB); |
| 174 | auto Width = Val->getType()->getIntegerBitWidth(); |
| 175 | auto DesiredWidth = Ty->getIntegerBitWidth(); |
| 176 | if (DesiredWidth == Width) |
| 177 | return Val; |
| 178 | if (DesiredWidth < Width) |
| 179 | return new TruncInst(Val, Ty, Name, BB); |
| 180 | if (C.flip()) |
| 181 | return new SExtInst(Val, Ty, Name, BB); |
| 182 | else |
| 183 | return new ZExtInst(Val, Ty, Name, BB); |
| 184 | } |
| 185 | |
| 186 | CmpInst::Predicate randomPred() { |
| 187 | return (CmpInst::Predicate)(CmpInst::FIRST_ICMP_PREDICATE + |