Skip to content

Commit 7285dda

Browse files
author
kroening
committed
added code for (T)(a?b:c) --> a?(T)b:(T)c
git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@3089 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
1 parent 4e33bc6 commit 7285dda

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/util/simplify_expr.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,21 @@ bool simplify_exprt::simplify_typecast(exprt &expr)
351351
simplify_typecast(expr); // rec. call
352352
return false;
353353
}
354+
355+
#if 0
356+
// (T)(a?b:c) --> a?(T)b:(T)c
357+
if(expr.op0().id()==ID_if &&
358+
expr.op0().operands().size()==3)
359+
{
360+
exprt tmp_op1=typecast_exprt(expr.op0().op1(), expr_type);
361+
exprt tmp_op2=typecast_exprt(expr.op0().op2(), expr_type);
362+
simplify_typecast(tmp_op1);
363+
simplify_typecast(tmp_op2);
364+
expr=if_exprt(expr.op0().op0(), tmp_op1, tmp_op2, expr_type);
365+
simplify_if(expr);
366+
return false;
367+
}
368+
#endif
354369

355370
const irep_idt &expr_type_id=expr_type.id();
356371
const exprt &operand=expr.op0();

0 commit comments

Comments
 (0)