Branch selection of if expressions
FIfExp.isParameterIf and FIfExp.cevalSelectExp are used frequently in attributes in FIfExp. We need to replace isParameterIf (in most places) with getIfExp().variability().knownParameterOrLess() and make sure that the test-expression is marked as structural. This is to reduce the number of unnecessary evaluations, for example FIfExp.size(), when called in the flat tree, will always re-evaluate a parameter test expression. It is also necessary since changing the parameter should generate an error, rather than silently doing nothing.
The test CCodeGenArrayTests.RecordArray8 (among probably many more) depends on the old behavior. The resulting c-code selects a branch even though the parameter is not marked as structural. This is due to the array size being in a record, that needs to be fixed as well.
Change History (5)
Description: |
modified (diff)
|
Summary: |
Branch selection of if equations →
Branch selection of if expressions
|
Resolution: |
→ fixed
|
Status: |
assigned →
closed
|
Shouldn't we also eliminate the if-expression in the flat tree if the test is knownParameterOrLess()?