@@ -735,26 +735,6 @@ let ChooseInvestigationPointLeftToRight frontiers =
735
735
| [] -> failwith " ChooseInvestigationPointLeftToRight: no frontiers!"
736
736
737
737
738
-
739
- #if OPTIMIZE_ LIST_ MATCHING
740
- // This is an initial attempt to remove extra typetests/castclass for simple list pattern matching "match x with h :: t -> ... | [] -> ..."
741
- // The problem with this technique is that it creates extra locals which inhibit the process of converting pattern matches into linear let bindings.
742
-
743
- [<return : Struct>]
744
- let (| ListConsDiscrim | _ |) g = function
745
- | ( DecisionTreeTest.UnionCase ( ucref, tinst))
746
- (* check we can use a simple 'isinst' instruction *)
747
- when tyconRefEq g ucref.TyconRef g.list_ tcr_ canon & ucref.CaseName = " op_ColonColon" -> ValueSome tinst
748
- | _ -> ValueNone
749
-
750
- [<return : Struct>]
751
- let (| ListEmptyDiscrim | _ |) g = function
752
- | ( DecisionTreeTest.UnionCase ( ucref, tinst))
753
- (* check we can use a simple 'isinst' instruction *)
754
- when tyconRefEq g ucref.TyconRef g.list_ tcr_ canon & ucref.CaseName = " op_Nil" -> ValueSome tinst
755
- | _ -> ValueNone
756
- #endif
757
-
758
738
[<return : Struct>]
759
739
let (| ConstNeedsDefaultCase | _ |) c =
760
740
match c with
@@ -806,17 +786,6 @@ let rec BuildSwitch inpExprOpt g expr edges dflt m =
806
786
| TCase(( DecisionTreeTest.IsNull | DecisionTreeTest.IsInst _), _) as edge :: edges, dflt ->
807
787
TDSwitch( expr, [ edge], Some ( BuildSwitch None g expr edges dflt m), m)
808
788
809
- #if OPTIMIZE_ LIST_ MATCHING
810
- // 'cons/nil' tests where we have stored the result of the cons test in an 'isinst' in a variable
811
- // In this case the 'expr' already holds the result of the 'isinst' test.
812
- | [ TCase( ListConsDiscrim g tinst, consCase)], Some emptyCase
813
- | [ TCase( ListEmptyDiscrim g tinst, emptyCase)], Some consCase
814
- | [ TCase( ListEmptyDiscrim g _, emptyCase); TCase( ListConsDiscrim g tinst, consCase)], None
815
- | [ TCase( ListConsDiscrim g tinst, consCase); TCase( ListEmptyDiscrim g _, emptyCase)], None
816
- when Option.isSome inpExprOpt ->
817
- TDSwitch( expr, [ TCase( DecisionTreeTest.IsNull, emptyCase)], Some consCase, m)
818
- #endif
819
-
820
789
// All these should also always have default cases
821
790
| TCase( DecisionTreeTest.Const ConstNeedsDefaultCase, _) :: _, None ->
822
791
error( InternalError( " inexhaustive match - need a default case!" , m))
@@ -1272,25 +1241,6 @@ let CompilePatternBasic
1272
1241
AdjustValToHaveValReprInfo v origInputVal.TryDeclaringEntity ValReprInfo.emptyValData
1273
1242
Some addrExp, Some ( mkInvisibleBind v e)
1274
1243
1275
-
1276
-
1277
- #if OPTIMIZE_ LIST_ MATCHING
1278
- | [ EdgeDiscrim(_, ListConsDiscrim g tinst, m); EdgeDiscrim(_, ListEmptyDiscrim g _, _)]
1279
- | [ EdgeDiscrim(_, ListEmptyDiscrim g _, _); EdgeDiscrim(_, ListConsDiscrim g tinst, m)]
1280
- | [ EdgeDiscrim(_, ListConsDiscrim g tinst, m)]
1281
- | [ EdgeDiscrim(_, ListEmptyDiscrim g tinst, m)]
1282
- (* check we can use a simple 'isinst' instruction *)
1283
- when isNil origInputValTypars ->
1284
-
1285
- let ucaseTy = ( mkProvenUnionCaseTy g.cons_ ucref tinst)
1286
- let v , vExpr = mkCompGenLocal m " unionTestResult" ucaseTy
1287
- if origInputVal.IsMemberOrModuleBinding then
1288
- AdjustValToHaveValReprInfo v origInputVal.DeclaringEntity ValReprInfo.emptyValData
1289
- let argExpr = GetSubExprOfInput subexpr
1290
- let appExpr = mkIsInst ucaseTy argExpr mMatch
1291
- Some vExpr, Some ( mkInvisibleBind v appExpr)
1292
- #endif
1293
-
1294
1244
// Active pattern matches: create a variable to hold the results of executing the active pattern.
1295
1245
// If a struct return we continue with an expression for taking the address of that location.
1296
1246
| EdgeDiscrim(_, DecisionTreeTest.ActivePatternCase( activePatExpr, resTys, retKind, _ apatVrefOpt, _, apinfo), m) :: _ ->
@@ -1343,9 +1293,6 @@ let CompilePatternBasic
1343
1293
let resPostBindOpt , ucaseBindOpt =
1344
1294
match discrim with
1345
1295
| DecisionTreeTest.UnionCase ( ucref, tinst) when
1346
- #if OPTIMIZE_ LIST_ MATCHING
1347
- isNone inpExprOpt &&
1348
- #endif
1349
1296
( isNil origInputValTypars &&
1350
1297
not origInputVal.IsMemberOrModuleBinding &&
1351
1298
not ucref.Tycon.IsStructRecordOrUnionTycon &&
0 commit comments