@@ -320,20 +320,16 @@ static StateValue fm_poison(State &s, expr a, const expr &ap, expr b,
320
320
non_poison &= !val.isInf ();
321
321
}
322
322
if (fmath.flags & FastMathFlags::ARCP) {
323
- s.useUnsupported (" arcp" );
324
- non_poison &= expr (); // TODO
323
+ s.doesApproximation (" arcp" , val);
325
324
}
326
325
if (fmath.flags & FastMathFlags::Contract) {
327
- s.useUnsupported (" contract" );
328
- non_poison &= expr (); // TODO
326
+ s.doesApproximation (" contract" , val);
329
327
}
330
328
if (fmath.flags & FastMathFlags::Reassoc) {
331
- s.useUnsupported (" reassoc" );
332
- non_poison &= expr (); // TODO
329
+ s.doesApproximation (" reassoc" , val);
333
330
}
334
331
if (fmath.flags & FastMathFlags::AFN) {
335
- s.useUnsupported (" afn" );
336
- non_poison &= expr (); // TODO
332
+ s.doesApproximation (" afn" , val);
337
333
}
338
334
if (fmath.flags & FastMathFlags::NSZ && !only_input)
339
335
val = any_fp_zero (s, move (val));
@@ -606,8 +602,12 @@ StateValue BinOp::toSMT(State &s) const {
606
602
case FRem:
607
603
fn = [&](auto a, auto ap, auto b, auto bp) -> StateValue {
608
604
// TODO; Z3 has no support for LLVM's frem which is actually an fmod
609
- s.useUnsupported (" frem" );
610
- return fm_poison (s, a, ap, b, bp, [](expr &a, expr &b) { return expr (); },
605
+ return fm_poison (s, a, ap, b, bp,
606
+ [&](expr &a, expr &b) {
607
+ auto val = expr::mkUF (" fmod" , {a, b}, a);
608
+ s.doesApproximation (" frem" , val);
609
+ return val;
610
+ },
611
611
fmath, false );
612
612
};
613
613
break ;
@@ -1285,8 +1285,9 @@ StateValue ConversionOp::toSMT(State &s) const {
1285
1285
break ;
1286
1286
case Int2Ptr:
1287
1287
fn = [&](auto &&val, auto &to_type) -> StateValue {
1288
- s.useUnsupported (" inttoptr" );
1289
- return { s.getMemory ().int2ptr (val), true };
1288
+ auto ret = s.getMemory ().int2ptr (val);
1289
+ s.doesApproximation (" inttoptr" , ret);
1290
+ return { move (ret), true };
1290
1291
};
1291
1292
break ;
1292
1293
}
@@ -1689,7 +1690,6 @@ static void unpack_inputs(State &s, Value &argv, Type &ty,
1689
1690
if (ty.isPtrType ()) {
1690
1691
expr np (true );
1691
1692
Pointer p (s.getMemory (), move (value.value ));
1692
- p.stripAttrs ();
1693
1693
if (argflag.has (ParamAttrs::Dereferenceable) ||
1694
1694
argflag.has (ParamAttrs::ByVal))
1695
1695
s.addUB (
0 commit comments