@@ -88,6 +88,7 @@ import {
88
88
} from "./program" ;
89
89
90
90
import {
91
+ findUsedLocals ,
91
92
FlowFlags ,
92
93
LocalFlags
93
94
} from "./flow" ;
@@ -1185,7 +1186,7 @@ function builtin_rotl(ctx: BuiltinContext): ExpressionRef {
1185
1186
case TypeKind . U16 : {
1186
1187
// (value << (shift & mask)) | (value >>> ((0 - shift) & mask))
1187
1188
let flow = compiler . currentFlow ;
1188
- let temp1 = flow . getTempLocal ( type ) ;
1189
+ let temp1 = flow . getTempLocal ( type , findUsedLocals ( arg1 ) ) ;
1189
1190
flow . setLocalFlag ( temp1 . index , LocalFlags . WRAPPED ) ;
1190
1191
let temp2 = flow . getTempLocal ( type ) ;
1191
1192
flow . setLocalFlag ( temp2 . index , LocalFlags . WRAPPED ) ;
@@ -1266,7 +1267,7 @@ function builtin_rotr(ctx: BuiltinContext): ExpressionRef {
1266
1267
case TypeKind . U16 : {
1267
1268
// (value >>> (shift & mask)) | (value << ((0 - shift) & mask))
1268
1269
let flow = compiler . currentFlow ;
1269
- let temp1 = flow . getTempLocal ( type ) ;
1270
+ let temp1 = flow . getTempLocal ( type , findUsedLocals ( arg1 ) ) ;
1270
1271
flow . setLocalFlag ( temp1 . index , LocalFlags . WRAPPED ) ;
1271
1272
let temp2 = flow . getTempLocal ( type ) ;
1272
1273
flow . setLocalFlag ( temp2 . index , LocalFlags . WRAPPED ) ;
@@ -1484,7 +1485,7 @@ function builtin_max(ctx: BuiltinContext): ExpressionRef {
1484
1485
if ( op != - 1 ) {
1485
1486
let flow = compiler . currentFlow ;
1486
1487
let nativeType = type . toNativeType ( ) ;
1487
- let temp1 = flow . getTempLocal ( type ) ;
1488
+ let temp1 = flow . getTempLocal ( type , findUsedLocals ( arg1 ) ) ;
1488
1489
flow . setLocalFlag ( temp1 . index , LocalFlags . WRAPPED ) ;
1489
1490
let temp2 = flow . getTempLocal ( type ) ;
1490
1491
flow . setLocalFlag ( temp2 . index , LocalFlags . WRAPPED ) ;
@@ -1563,7 +1564,7 @@ function builtin_min(ctx: BuiltinContext): ExpressionRef {
1563
1564
if ( op != - 1 ) {
1564
1565
let flow = compiler . currentFlow ;
1565
1566
let nativeType = type . toNativeType ( ) ;
1566
- let temp1 = flow . getTempLocal ( type ) ;
1567
+ let temp1 = flow . getTempLocal ( type , findUsedLocals ( arg1 ) ) ;
1567
1568
flow . setLocalFlag ( temp1 . index , LocalFlags . WRAPPED ) ;
1568
1569
let temp2 = flow . getTempLocal ( type ) ;
1569
1570
flow . setLocalFlag ( temp2 . index , LocalFlags . WRAPPED ) ;
0 commit comments