MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / adapt

Method adapt

tools/quick-fuzz.cpp:171–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 +

Callers 1

goMethod · 0.80

Calls 2

chooseMethod · 0.80
flipMethod · 0.80

Tested by

no test coverage detected