@@ -735,26 +735,6 @@ let ChooseInvestigationPointLeftToRight frontiers =
735735 | [] -> failwith " ChooseInvestigationPointLeftToRight: no frontiers!"
736736
737737
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-
758738[<return : Struct>]
759739let (| ConstNeedsDefaultCase | _ |) c =
760740 match c with
@@ -806,17 +786,6 @@ let rec BuildSwitch inpExprOpt g expr edges dflt m =
806786 | TCase(( DecisionTreeTest.IsNull | DecisionTreeTest.IsInst _), _) as edge :: edges, dflt ->
807787 TDSwitch( expr, [ edge], Some ( BuildSwitch None g expr edges dflt m), m)
808788
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-
820789 // All these should also always have default cases
821790 | TCase( DecisionTreeTest.Const ConstNeedsDefaultCase, _) :: _, None ->
822791 error( InternalError( " inexhaustive match - need a default case!" , m))
@@ -1272,25 +1241,6 @@ let CompilePatternBasic
12721241 AdjustValToHaveValReprInfo v origInputVal.TryDeclaringEntity ValReprInfo.emptyValData
12731242 Some addrExp, Some ( mkInvisibleBind v e)
12741243
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-
12941244 // Active pattern matches: create a variable to hold the results of executing the active pattern.
12951245 // If a struct return we continue with an expression for taking the address of that location.
12961246 | EdgeDiscrim(_, DecisionTreeTest.ActivePatternCase( activePatExpr, resTys, retKind, _ apatVrefOpt, _, apinfo), m) :: _ ->
@@ -1343,9 +1293,6 @@ let CompilePatternBasic
13431293 let resPostBindOpt , ucaseBindOpt =
13441294 match discrim with
13451295 | DecisionTreeTest.UnionCase ( ucref, tinst) when
1346- #if OPTIMIZE_ LIST_ MATCHING
1347- isNone inpExprOpt &&
1348- #endif
13491296 ( isNil origInputValTypars &&
13501297 not origInputVal.IsMemberOrModuleBinding &&
13511298 not ucref.Tycon.IsStructRecordOrUnionTycon &&
0 commit comments