@@ -403,11 +403,9 @@ std::optional<HeapType> getBasicHeapTypeLUB(HeapType::BasicHeapType a,
403
403
if (unsigned (a) > unsigned (b)) {
404
404
std::swap (a, b);
405
405
}
406
- auto bUnshared = HeapType (b).getBasic (Unshared);
407
406
HeapType lubUnshared;
408
407
switch (HeapType (a).getBasic (Unshared)) {
409
408
case HeapType::ext:
410
- assert (bUnshared == HeapType::string);
411
409
lubUnshared = HeapType::ext;
412
410
break ;
413
411
case HeapType::func:
@@ -418,36 +416,16 @@ std::optional<HeapType> getBasicHeapTypeLUB(HeapType::BasicHeapType a,
418
416
lubUnshared = HeapType::any;
419
417
break ;
420
418
case HeapType::eq:
421
- if (bUnshared == HeapType::i31 || bUnshared == HeapType::struct_ ||
422
- bUnshared == HeapType::array) {
423
- lubUnshared = HeapType::eq;
424
- } else {
425
- lubUnshared = HeapType::any;
426
- }
427
- break ;
428
419
case HeapType::i31:
429
- if (bUnshared == HeapType::struct_ || bUnshared == HeapType::array) {
430
- lubUnshared = HeapType::eq;
431
- } else {
432
- lubUnshared = HeapType::any;
433
- }
434
- break ;
435
420
case HeapType::struct_:
436
- if (bUnshared == HeapType::array) {
437
- lubUnshared = HeapType::eq;
438
- } else {
439
- lubUnshared = HeapType::any;
440
- }
421
+ lubUnshared = HeapType::eq;
441
422
break ;
442
423
case HeapType::array:
443
- lubUnshared = HeapType::any;
444
- break ;
445
424
case HeapType::string:
446
- // String has already been handled: we sorted before in a way that ensures
447
- // the type the string is compared to is of a higher index, which means it
448
- // is a bottom type (string is the last type that is not a bottom type),
449
- // but we have handled the case of either a or b being a bottom type
450
- // earlier already.
425
+ // As the last non-bottom types in their hierarchies, it should not be
426
+ // possible for `a` to be array or string. We know that `b` != `a` and
427
+ // that `b` is not bottom, but that `b` and `a` are in the same hierarchy,
428
+ // so there are no possible value for `b`.
451
429
case HeapType::none:
452
430
case HeapType::noext:
453
431
case HeapType::nofunc:
0 commit comments