Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Avoid conversion of of a = b to b = -(-a), ticket:5144
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Oct 20, 2018
1 parent e57c4cc commit 13e5b32
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Compiler/BackEnd/ExpressionSolve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,15 @@ algorithm
// -f(a) = b => f(a) = -b
case DAE.UNARY(op as DAE.UMINUS(), fa)
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
then(fa, DAE.UNARY(op, inExp2), true);
equation
b = Expression.negate(inExp2);
then (fa, b, true);

case DAE.UNARY(op as DAE.UMINUS_ARR(), fa)
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
equation
b = DAE.UNARY(op, inExp2);
then(fa, b, true);
b = Expression.negate(inExp2);
then (fa, b, true);

// b/f(a) = rhs => f(a) = b/rhs solve for a
case DAE.BINARY(b,DAE.DIV(_),fa)
Expand Down

0 comments on commit 13e5b32

Please sign in to comment.