fix a problem with const fold optimization in if expressions, and IR compilation of that

This commit is contained in:
Irmen de Jong
2024-04-09 22:09:29 +02:00
parent 7a6f2ecc8c
commit db80417bd7
3 changed files with 17 additions and 20 deletions
@@ -1451,6 +1451,10 @@ class IRCodeGen(
}
when(val cond=ifElse.condition) {
is PtBool -> {
// normally this will be optimized away, but not with -noopt
translateSimple(cond, Opcode.BSTEQ)
}
is PtTypeCast -> {
require(cond.type==DataType.BOOL && cond.value.type in NumericDatatypes)
translateSimple(cond, Opcode.BSTEQ)