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

Commit 13e5b32

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Avoid conversion of of a = b to b = -(-a), ticket:5144
Belonging to [master]: - #2733 - OpenModelica/OpenModelica-testsuite#1056
1 parent e57c4cc commit 13e5b32

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Compiler/BackEnd/ExpressionSolve.mo

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,15 @@ algorithm
584584
// -f(a) = b => f(a) = -b
585585
case DAE.UNARY(op as DAE.UMINUS(), fa)
586586
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
587-
then(fa, DAE.UNARY(op, inExp2), true);
587+
equation
588+
b = Expression.negate(inExp2);
589+
then (fa, b, true);
588590

589591
case DAE.UNARY(op as DAE.UMINUS_ARR(), fa)
590592
guard expHasCref(fa, inExp3) and not expHasCref(inExp2, inExp3)
591593
equation
592-
b = DAE.UNARY(op, inExp2);
593-
then(fa, b, true);
594+
b = Expression.negate(inExp2);
595+
then (fa, b, true);
594596

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

0 commit comments

Comments
 (0)