Skip to content

Commit 743eec1

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Add equation size to vectorized equalities and for loops
Belonging to [master]: - OpenModelica/OMCompiler#2738 - OpenModelica/OpenModelica-testsuite#1060
1 parent 8e8393f commit 743eec1

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

Compiler/BackEnd/BackendEquation.mo

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,6 @@ algorithm
16641664
osize := match eq
16651665
local
16661666
list<Integer> ds;
1667-
DAE.Exp e1, e2;
16681667
Integer size, start, stop;
16691668
list<BackendDAE.Equation> eqnsfalse;
16701669

@@ -1694,14 +1693,8 @@ algorithm
16941693
size = equationLstSize(eqnsfalse);
16951694
then size;
16961695

1697-
case BackendDAE.FOR_EQUATION(start = e1, stop = e2) equation
1698-
if Flags.isSet(Flags.NF_SCALARIZE) then
1699-
DAE.ICONST(start) = e1;
1700-
DAE.ICONST(stop) = e2;
1701-
size = stop - start + 1;
1702-
else
1703-
size = 1;
1704-
end if;
1696+
case BackendDAE.FOR_EQUATION(start = DAE.ICONST(start), stop = DAE.ICONST(stop)) equation
1697+
size = stop - start + 1;
17051698
then size;
17061699

17071700
else equation

Compiler/NFFrontEnd/NFFlatten.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ algorithm
635635
Integer stop;
636636
Expression range;
637637
case Equation.EQUALITY(lhs = Expression.CREF(), rhs = Expression.CREF())
638-
// let simple equality as is
639-
then eqn;
638+
// convert simple equality of crefs to array equality
639+
then Equation.ARRAY_EQUALITY(eqn.lhs, eqn.rhs, Type.liftArrayLeftList(eqn.ty, dimensions), eqn.source);
640640
else
641641
// wrap general equation into for loop
642642
algorithm

0 commit comments

Comments
 (0)