Skip to content

Commit

Permalink
avoid work
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Mar 5, 2023
1 parent 1436480 commit 8acd94f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/res/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.10-dev
8.10
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,24 @@ internal class NotExpressionAndIfComparisonExprChanger(val program: Program, val
if(compTarget.name == VMTarget.NAME) // don't apply this optimization for Vm target
return CondExprSimplificationResult(null, null, null, null)

val leftDt = expr.left.inferType(program)
val rightDt = expr.right.inferType(program)

if(!leftDt.isInteger || !rightDt.isInteger) {
// we can't reasonably simplify non-integer expressions
return CondExprSimplificationResult(null, null, null, null)
}

var leftAssignment: Assignment? = null
var leftOperandReplacement: Expression? = null
var rightAssignment: Assignment? = null
var rightOperandReplacement: Expression? = null

val separateLeftExpr = !expr.left.isSimple
&& expr.left !is IFunctionCall
&& expr.left !is ContainmentCheck
val separateRightExpr = !expr.right.isSimple
&& expr.right !is IFunctionCall
&& expr.right !is ContainmentCheck
val leftDt = expr.left.inferType(program)
val rightDt = expr.right.inferType(program)

if(!leftDt.isInteger || !rightDt.isInteger) {
// we can't reasonably simplify non-integer expressions
return CondExprSimplificationResult(null, null, null, null)
}

if(separateLeftExpr) {
val name = getTempRegisterName(leftDt)
Expand Down

0 comments on commit 8acd94f

Please sign in to comment.