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

Commit 8feaea8

Browse files
lochelOpenModelica-Hudson
authored andcommitted
Revert "fixed PR 1148"
This reverts commit 893adb7.
1 parent 2722e76 commit 8feaea8

File tree

2 files changed

+16
-91
lines changed

2 files changed

+16
-91
lines changed

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 16 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4272,9 +4272,16 @@ algorithm
42724272
(eqs, vars, updated) := simplifyComplexFunctionWork(eqn, withTmpVars);
42734273
if updated
42744274
then
4275-
indRemove := i :: indRemove;
4276-
eqsAll := listAppend(eqs, eqsAll);
4277-
varsAll := listAppend(vars, varsAll);
4275+
if listLength(eqs) == 1
4276+
then
4277+
//BackendDump.printEquation(eqn);
4278+
{eqn} := eqs;
4279+
eqns := BackendEquation.setAtIndex(eqns, i, eqn);
4280+
else
4281+
indRemove := i :: indRemove;
4282+
eqsAll := listAppend(eqs, eqsAll);
4283+
varsAll := listAppend(vars, varsAll);
4284+
end if;
42784285
end if;
42794286
else
42804287
//BackendDump.printEquation(BackendEquation.equationNth1(eqns, i));
@@ -4371,30 +4378,8 @@ protected
43714378
list<DAE.Exp> left_lst, right_lst;
43724379
Boolean expanted = true, _updated;
43734380
BackendDAE.Equation eqn;
4374-
Boolean expandLeft = true, expandRight = true, restart;
4375-
DAE.Exp lhs, rhs;
43764381
algorithm
43774382

4378-
restart := match(left, right)
4379-
case (DAE.ARRAY(array = {lhs}),_)
4380-
equation
4381-
rhs = Expression.makeASUB(right,{DAE.ICONST(1)});
4382-
then
4383-
true;
4384-
case (_, DAE.ARRAY(array = {rhs}))
4385-
equation
4386-
lhs = Expression.makeASUB(left,{DAE.ICONST(1)});
4387-
then
4388-
true;
4389-
else false;
4390-
end match;
4391-
if restart
4392-
then
4393-
(eqs, vars, updated) := simplifyComplexFunctionWorkCE_AE_WORK(lhs, rhs, withTmpVars, source, attr);
4394-
return ;
4395-
end if;
4396-
4397-
43984383
if Expression.isTuple(left)
43994384
then
44004385
DAE.TUPLE(PR = left_lst) := left;
@@ -4408,7 +4393,6 @@ algorithm
44084393
DAE.ARRAY(array=left_lst) := left;
44094394
else
44104395
expanted := false;
4411-
expandLeft := false;
44124396
end if;
44134397

44144398
if Expression.isTuple(right)
@@ -4424,24 +4408,11 @@ algorithm
44244408
DAE.ARRAY(array=right_lst) := right;
44254409
else
44264410
expanted := false;
4427-
expandRight := false;
44284411
end if;
44294412

4430-
4431-
if expanted
4432-
then
4413+
if expanted then
44334414
(eqs, vars, updated) := simplifyComplexFunctionWorkTT(left_lst, right_lst, withTmpVars, source, attr);
44344415

4435-
elseif expandRight and Expression.isCall(left) and Expression.hasWild(right_lst)
4436-
then
4437-
//print(ExpressionDump.printExpStr(left));
4438-
(right_lst, left_lst) := simplifyComplexFunctionWorkWild(right_lst, left);
4439-
(eqs, vars, updated) := simplifyComplexFunctionWorkTT(left_lst, right_lst, withTmpVars, source, attr);
4440-
elseif expandLeft and Expression.isCall(right) and Expression.hasWild(left_lst)
4441-
then
4442-
//print(ExpressionDump.printExpStr(left));
4443-
(left_lst, right_lst) := simplifyComplexFunctionWorkWild(left_lst, right);
4444-
(eqs, vars, updated) := simplifyComplexFunctionWorkTT(left_lst, right_lst, withTmpVars, source, attr);
44454416
elseif Expression.isWild(left) or Expression.isWild(right)
44464417
then // _ = ... or ... = _
44474418
eqs := {};
@@ -4468,37 +4439,13 @@ algorithm
44684439

44694440
else
44704441
eqn := BackendEquation.generateEquation(left, right, source, attr);
4471-
eqs := {eqn};
4442+
eqs := {eqn};
44724443
vars := {};
44734444
updated := false;
44744445
end if;
44754446
end simplifyComplexFunctionWorkCE_AE_WORK;
44764447

44774448

4478-
4479-
protected function simplifyComplexFunctionWorkWild
4480-
input list<DAE.Exp> _left_lst;
4481-
input DAE.Exp right;
4482-
output list<DAE.Exp> left_lst = {};
4483-
output list<DAE.Exp> right_lst = {};
4484-
protected
4485-
DAE.Type ty;
4486-
Integer idx = 1;
4487-
algorithm
4488-
for left in _left_lst
4489-
loop
4490-
if not Expression.isWild(left)
4491-
then
4492-
ty := Expression.typeof(left);
4493-
left_lst := left :: left_lst;
4494-
right_lst := DAE.TSUB(right, idx, ty) :: right_lst;
4495-
idx := idx + 1;
4496-
end if;
4497-
end for;
4498-
4499-
end simplifyComplexFunctionWorkWild;
4500-
4501-
45024449
protected function simplifyComplexFunctionWorkTT
45034450
input list<DAE.Exp> _left_lst;
45044451
input list<DAE.Exp> _right_lst;
@@ -4528,17 +4475,10 @@ algorithm
45284475
loop
45294476
lhs :: left_lst := left_lst;
45304477
rhs :: right_lst := right_lst;
4531-
if Expression.isWild(lhs) or Expression.isWild(rhs)
4532-
then
4533-
//print(ExpressionDump.printExpStr(lhs));
4534-
//print(ExpressionDump.printExpStr(rhs));
4535-
updated := true;
4536-
else
4537-
(_eqs, _vars, _updated) := simplifyComplexFunctionWorkCE_AE_WORK(lhs, rhs, withTmpVars, source, attr);
4538-
eqs := listAppend(_eqs, eqs);
4539-
vars := listAppend(_vars, vars);
4540-
updated := updated or _updated;
4541-
end if;
4478+
(_eqs, _vars, _updated) := simplifyComplexFunctionWorkCE_AE_WORK(lhs, rhs, withTmpVars, source, attr);
4479+
eqs := listAppend(_eqs, eqs);
4480+
vars := listAppend(_vars, vars);
4481+
updated := updated or _updated;
45424482
end for;
45434483
end simplifyComplexFunctionWorkTT;
45444484

Compiler/FrontEnd/Expression.mo

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10568,21 +10568,6 @@ algorithm
1056810568
end match;
1056910569
end isWild;
1057010570

10571-
public function hasWild
10572-
input list<DAE.Exp> lstExp;
10573-
output Boolean b = false;
10574-
algorithm
10575-
for elem in lstExp
10576-
loop
10577-
if isWild(elem)
10578-
then
10579-
b := true;
10580-
break;
10581-
end if;
10582-
end for;
10583-
10584-
end hasWild;
10585-
1058610571
public function isNotWild
1058710572
input DAE.Exp exp;
1058810573
output Boolean b;

0 commit comments

Comments
 (0)