From 46d9c5b683fdd93bea2f3b6e292224b951eff0ad Mon Sep 17 00:00:00 2001 From: vruge Date: Wed, 29 Aug 2018 22:21:42 +0200 Subject: [PATCH] [BE] fixes for inStream fixes if posetiveMax is called for constant Belonging to [master]: - OpenModelica/OMCompiler#2623 --- Compiler/BackEnd/BackendDAEOptimize.mo | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Compiler/BackEnd/BackendDAEOptimize.mo b/Compiler/BackEnd/BackendDAEOptimize.mo index a07f9da3f9..f47652af2b 100644 --- a/Compiler/BackEnd/BackendDAEOptimize.mo +++ b/Compiler/BackEnd/BackendDAEOptimize.mo @@ -173,10 +173,11 @@ algorithm then if simplifyToZero then Expression.createZeroExpression(tp) else Expression.makePureBuiltinCall("max", {e, expr}, tp); - //positiveMax(-cref, eps) = -cref where variable is constant <= 0 - case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr}) guard Expression.isNegativeOrZero(e) + //positiveMax(cref, eps) = cref where cref >= 0 + case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr}) guard Expression.isPositiveOrZero(e) then e; + // e.g. positiveMax(cref, eps) = max(cref,eps) = eps where cref < 0 case DAE.CALL(path=Absyn.IDENT("$OMC$PositiveMax"),expLst={e, expr}) //print("\nsimplifyInStreamWork: "); //print(ExpressionDump.printExpStr(inExp));