Skip to content

Commit 214942b

Browse files
committed
fix optimizer bug
1 parent 5e27fdc commit 214942b

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ To install or update LODA, please follow the [installation instructions](https:/
22

33
## [Unreleased]
44

5+
### Bugfixes
6+
7+
* Fix optimizer bug
8+
59
## v25.8.28
610

711
### Bugfixes

src/eval/optimizer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,6 @@ bool Optimizer::fixSandwich(Program &p) const {
488488
std::swap(op1, op2);
489489
op2.source.value *= op1.source.value;
490490
changed = true;
491-
} else if (ProgramUtil::isAdditive(op1.type) &&
492-
op2.type == Operation::Type::DIV &&
493-
ProgramUtil::isAdditive(op3.type) &&
494-
Number::ONE < op1.source.value &&
495-
Number::ONE < op2.source.value &&
496-
Semantics::mod(op1.source.value, op2.source.value) ==
497-
Number::ZERO) {
498-
std::swap(op1, op2);
499-
op2.source.value /= op1.source.value;
500-
changed = true;
501491
} else if (ProgramUtil::isAdditive(op2.type) && op1.type == op3.type) {
502492
if (op1.type == Operation::Type::DIV) {
503493
std::swap(op1, op2);

tests/optimizer/E044.asm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
; in
2-
sub $0,10
3-
div $0,2
4-
add $0,3
2+
mul $0,7
3+
add $0,14
4+
div $0,7
55
; out
6-
div $0,2
7-
sub $0,2
6+
add $0,2

0 commit comments

Comments
 (0)