Skip to content

Commit b229ca5

Browse files
committed
[Lang] qd.precise: use make_typed to avoid downcast on synthesized 2*a stmt
1 parent a44208d commit b229ca5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

quadrants/transforms/alg_simp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,12 @@ class AlgSimp : public BasicStmtVisitor {
374374
if (alg_is_two(lhs))
375375
a = stmt->rhs;
376376
cast_to_result_type(a, stmt);
377-
auto sum = Stmt::make<BinaryOpStmt>(BinaryOpType::add, a, a);
377+
auto sum = Stmt::make_typed<BinaryOpStmt>(BinaryOpType::add, a, a);
378378
sum->ret_type = a->ret_type;
379379
sum->dbg_info = stmt->dbg_info;
380380
// `2 * a` and `a + a` are IEEE-equivalent, but the synthesized add must carry `precise` so the
381381
// downstream FMF clear / NoContraction plumbing still sees the user's opt-in tag.
382-
static_cast<BinaryOpStmt *>(sum.get())->precise = stmt->precise;
382+
sum->precise = stmt->precise;
383383
stmt->replace_usages_with(sum.get());
384384
modifier.insert_before(stmt, std::move(sum));
385385
modifier.erase(stmt);

0 commit comments

Comments
 (0)