Skip to content

Commit c327342

Browse files
committed
Fixed a bug where loop reduction with an initial value with side effects repeated the side effect
1 parent 3505018 commit c327342

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Version 7.4.0
33
- Fixed compile time calculations of QLOG and QEXP (thanks to Ada)
44
- Fixed many incorrect address calculations for Spin2 ^x variables
55
- Fixed parsing of large immediate addresses for inline asm call/jmp
6+
- Fixed a long standing bug in loop reduction
67
- Improved some nucode peephole optimizations
78
- Some longfill optimizations and bug fixes (thanks to Ada)
89

loops.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ doLoopStrengthReduction(LoopValueSet *initial, AST *body, AST *condition, AST *u
713713
if (!initEntry || (initEntry->flags & LVFLAG_CONDITIONAL) ) {
714714
continue;
715715
}
716+
if (ExprHasSideEffects(initEntry->value)) {
717+
continue;
718+
}
716719
lastAssign = FindName(&lv, entry->basename);
717720
if (!lastAssign) {
718721
continue;

0 commit comments

Comments
 (0)