diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index 2b53ab7436f..91123fbe1f0 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1382,6 +1382,84 @@ let rec (|KnownValApp|_|) expr = | Expr.App(KnownValApp(vref, typeArgs1, otherArgs1), _, typeArgs2, otherArgs2, _) -> Some(vref, typeArgs1@typeArgs2, otherArgs1@otherArgs2) | _ -> None +/// Matches boolean decision tree: +/// check single case with bool const. +let (|TDBoolSwitch|_|) dtree = + match dtree with + | TDSwitch( expr, [TCase (DecisionTreeTest.Const(Const.Bool testBool), caseTree )], Some defaultTree, range) -> + Some (expr, testBool, caseTree, defaultTree, range) + | _ -> + None + +/// Check target that have a constant bool value +let (|ConstantBoolTarget|_|) target = + match target with + | TTarget([], Expr.Const (Const.Bool b,_,_),_) -> Some b + | _ -> None + +/// Is this a tree, where each decision is a two-way switch (to prevent later duplication of trees), and each branch returns or true/false, +/// apart from one branch which defers to another expression +let rec CountBoolLogicTree ((targets: DecisionTreeTarget[], costOuterCaseTree, costOuterDefaultTree, testBool) as data) tree = + match tree with + | TDSwitch (_expr, [case], Some defaultTree, _range) -> + let tc1,ec1 = CountBoolLogicTree data case.CaseTree + let tc2, ec2 = CountBoolLogicTree data defaultTree + tc1 + tc2, ec1 + ec2 + | TDSuccess([], idx) -> + match targets.[idx] with + | ConstantBoolTarget result -> (if result = testBool then costOuterCaseTree else costOuterDefaultTree), 0 + | TTarget([], _exp, _) -> costOuterCaseTree + costOuterDefaultTree, 10 + | _ -> 100, 100 + | _ -> 100, 100 + +/// Rewrite a decision tree for which CountBoolLogicTree returned a low number (see below). Produce a new decision +/// tree where at each ConstantBoolSuccessTree tip we replace with either outerCaseTree or outerDefaultTree +/// depending on whether the target result was true/false +let rec RewriteBoolLogicTree ((targets: DecisionTreeTarget[], outerCaseTree, outerDefaultTree, testBool) as data) tree = + match tree with + | TDSwitch (expr, cases, defaultTree, range) -> + let cases2 = cases |> List.map (RewriteBoolLogicCase data) + let defaultTree2 = defaultTree |> Option.map (RewriteBoolLogicTree data) + TDSwitch (expr, cases2, defaultTree2, range) + | TDSuccess([], idx) -> + match targets.[idx] with + | ConstantBoolTarget result -> if result = testBool then outerCaseTree else outerDefaultTree + | TTarget([], exp, _) -> mkBoolSwitch exp.Range exp (if testBool then outerCaseTree else outerDefaultTree) (if testBool then outerDefaultTree else outerCaseTree) + | _ -> failwith "CountBoolLogicTree should exclude this case" + | _ -> failwith "CountBoolLogicTree should exclude this case" + +and RewriteBoolLogicCase data (TCase(test, tree)) = + TCase(test, RewriteBoolLogicTree data tree) + +/// Repeatedly combine switch-over-match decision trees, see https://github.com/Microsoft/visualfsharp/issues/635. +/// The outer decision tree is doing a swithc over a boolean result, the inner match is producing only +/// constant boolean results in its targets. +let rec CombineBoolLogic expr = + + // try to find nested boolean switch + match expr with + | Expr.Match(outerSP, outerMatchRange, + TDBoolSwitch(Expr.Match(_innerSP, _innerMatchRange, innerTree, innerTargets, _innerDefaultRange, _innerMatchTy), + outerTestBool, outerCaseTree, outerDefaultTree, _outerSwitchRange ), + outerTargets, outerDefaultRange, outerMatchTy) -> + + let costOuterCaseTree = match outerCaseTree with TDSuccess _ -> 0 | _ -> 1 + let costOuterDefaultTree = match outerDefaultTree with TDSuccess _ -> 0 | _ -> 1 + let tc, ec = CountBoolLogicTree (innerTargets, costOuterCaseTree, costOuterDefaultTree, outerTestBool) innerTree + // At most one expression, no overall duplication of TSwitch nodes + if tc <= costOuterCaseTree + costOuterDefaultTree && ec <= 10 then + let newExpr = + Expr.Match(outerSP, outerMatchRange, + RewriteBoolLogicTree (innerTargets, outerCaseTree, outerDefaultTree, outerTestBool) innerTree, + outerTargets, outerDefaultRange, outerMatchTy) + + CombineBoolLogic newExpr + else + expr + | _ -> + expr + + //------------------------------------------------------------------------- // ExpandStructuralBinding // @@ -2814,7 +2892,9 @@ and OptimizeMatch cenv env (spMatch, exprm, dtree, targets, m, ty) = // REVIEW: consider collecting, merging and using information flowing through each line of the decision tree to each target let dtree', dinfo = OptimizeDecisionTree cenv env m dtree let targets', tinfos = OptimizeDecisionTreeTargets cenv env m targets - RebuildOptimizedMatch (spMatch, exprm, m, ty, dtree', targets', dinfo, tinfos) + let newExpr, newInfo = RebuildOptimizedMatch (spMatch, exprm, m, ty, dtree', targets', dinfo, tinfos) + let newExpr2 = if not (cenv.settings.localOpt()) then newExpr else CombineBoolLogic newExpr + newExpr2, newInfo and CombineMatchInfos dinfo tinfo = { TotalSize = dinfo.TotalSize + tinfo.TotalSize diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index 27130dc0859..53b253b1ab7 100644 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -261,7 +261,7 @@ type ValFlags(flags:int64) = (flags &&& ~~~0b0011001100000000000L) /// Represents the kind of a type parameter -[] +[] type TyparKind = | Type @@ -273,10 +273,10 @@ type TyparKind = | TyparKind.Type -> None | TyparKind.Measure -> Some "Measure" - [] - member x.DebugText = x.ToString() + //[] + //member x.DebugText = x.ToString() - override x.ToString() = + override x.ToString() = match x with | TyparKind.Type -> "type" | TyparKind.Measure -> "measure" @@ -1349,7 +1349,7 @@ and override x.ToString() = "TyconAugmentation(...)" and - [] + [] /// The information for the contents of a type. Also used for a provided namespace. TyconRepresentation = @@ -1393,10 +1393,10 @@ and /// The information for exception definitions should be folded into here. | TNoRepr - [] - member x.DebugText = x.ToString() + //[] + //member x.DebugText = x.ToString() - override x.ToString() = "TyconRepresentation(...)" + override x.ToString() = sprintf "%+A" x and [] @@ -1751,7 +1751,7 @@ and override x.ToString() = x.Name and - [] + [] ExceptionInfo = /// Indicates that an exception is an abbreviation for the given exception | TExnAbbrevRepr of TyconRef @@ -1765,10 +1765,11 @@ and /// Indicates that an exception is abstract, i.e. is in a signature file, and we do not know the representation | TExnNone - [] - member x.DebugText = x.ToString() + // %+A formatting is used, so this is not needed + //[] + //member x.DebugText = x.ToString() - override x.ToString() = "ExceptionInfo(...)" + override x.ToString() = sprintf "%+A" x and [] ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueList, entities: QueueList) = @@ -2340,11 +2341,11 @@ and /// Indicates a constraint that a type is .NET unmanaged type | IsUnmanaged of range - // Prefer the default formatting of this union type + // %+A formatting is used, so this is not needed //[] //member x.DebugText = x.ToString() - // - //override x.ToString() = "TyparConstraint(...)" + + override x.ToString() = sprintf "%+A" x /// The specification of a member constraint that must be solved and @@ -2374,7 +2375,7 @@ and override x.ToString() = "TTrait(" + x.MemberName + ")" and - [] + [] /// Indicates the solution of a member constraint during inference. TraitConstraintSln = @@ -2411,10 +2412,11 @@ and /// Indicates a trait is solved by a 'fake' instance of an operator, like '+' on integers | BuiltInSln - [] - member x.DebugText = x.ToString() + // %+A formatting is used, so this is not needed + //[] + //member x.DebugText = x.ToString() - override x.ToString() = "TraitConstraintSln(...)" + override x.ToString() = sprintf "%+A" x /// The partial information used to index the methods of all those in a ModuleOrNamespace. and [] @@ -3996,11 +3998,11 @@ and /// Raising a measure to a rational power | RationalPower of Measure * Rational - // Prefer the default formatting of this union type + // %+A formatting is used, so this is not needed //[] //member x.DebugText = x.ToString() - // - //override x.ToString() = "Measure(...)" + + override x.ToString() = sprintf "%+A" x and [] @@ -4249,7 +4251,7 @@ and and Attribs = Attrib list and - [] + [] AttribKind = /// Indicates an attribute refers to a type defined in an imported .NET assembly @@ -4258,10 +4260,11 @@ and /// Indicates an attribute refers to a type defined in an imported F# assembly | FSAttrib of ValRef - [] - member x.DebugText = x.ToString() + // %+A formatting is used, so this is not needed + //[] + //member x.DebugText = x.ToString() - override x.ToString() = sprintf "AttribKind(...)" + override x.ToString() = sprintf "%+A" x /// Attrib(kind,unnamedArgs,propVal,appliedToAGetterOrSetter,targetsOpt,range) and @@ -4325,10 +4328,11 @@ and [] /// Decision trees. Pattern matching has been compiled down to /// a decision tree by this point. The right-hand-sides (actions) of +/// a decision tree by this point. The right-hand-sides (actions) of /// the decision tree are labelled by integers that are unique for that /// particular tree. and - [] + [] DecisionTree = /// TDSwitch(input, cases, default, range) @@ -4357,10 +4361,11 @@ and /// body -- the rest of the decision tree | TDBind of Binding * DecisionTree - [] - member x.DebugText = x.ToString() + // %+A formatting is used, so this is not needed + //[] + //member x.DebugText = x.ToString() - override x.ToString() = sprintf "DecisionTree(...)" + override x.ToString() = sprintf "%+A" x /// Represents a test and a subsequent decision tree and @@ -4380,7 +4385,7 @@ and override x.ToString() = sprintf "DecisionTreeCase(...)" and - [] + [] DecisionTreeTest = /// Test if the input to a decision tree matches the given union case | UnionCase of UnionCaseRef * TypeInst @@ -4410,10 +4415,11 @@ and /// activePatternInfo -- The extracted info for the active pattern. | ActivePatternCase of Expr * TTypes * (ValRef * TypeInst) option * int * ActivePatternInfo - [] - member x.DebugText = x.ToString() + // %+A formatting is used, so this is not needed + //[] + //member x.DebugText = x.ToString() - override x.ToString() = sprintf "DecisionTreeTest(...)" + override x.ToString() = sprintf "%+A" x /// A target of a decision tree. Can be thought of as a little function, though is compiled as a local block. and @@ -4907,7 +4913,7 @@ and /// The contents of a module-or-namespace-fragment definition and - [] + [] ModuleOrNamespaceExpr = /// Indicates the module is a module with a signature | TMAbstract of ModuleOrNamespaceExprWithSig @@ -4924,10 +4930,11 @@ and /// Indicates the module fragment is a 'rec' or 'non-rec' definition of types and modules | TMDefRec of isRec:bool * Tycon list * ModuleOrNamespaceBinding list * range - [] + // %+A formatting is used, so this is not needed + //[] member x.DebugText = x.ToString() - override x.ToString() = "ModuleOrNamespaceExpr(...)" + override x.ToString() = sprintf "%+A" x /// A named module-or-namespace-fragment definition and diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl index 647f036e721..601e4ffc1e7 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter01.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000208 Length: 0x0000007A } .module GenIter01.exe -// MVID: {5B9A68C0-F836-DC98-A745-0383C0689A5B} +// MVID: {5B9A6329-F836-DC98-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00950000 +// Image base: 0x01080000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl index 4ff497aacad..aa203793fe4 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter02.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000208 Length: 0x0000007B } .module GenIter02.exe -// MVID: {5B9A68C0-F857-DC98-A745-0383C0689A5B} +// MVID: {5B9A6329-F857-DC98-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x01060000 +// Image base: 0x02900000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl index 67c132e45f3..88bd760bc85 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter03.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000208 Length: 0x0000007B } .module GenIter03.exe -// MVID: {5B9A68C0-F77C-DC98-A745-0383C0689A5B} +// MVID: {5B9A6329-F77C-DC98-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00770000 +// Image base: 0x026B0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl index e2163e3a4f5..25a08dfd652 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/GeneratedIterators/GenIter04.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x000001F8 Length: 0x0000007B } .module GenIter04.exe -// MVID: {5B9A68C0-F79D-DC98-A745-0383C0689A5B} +// MVID: {5B9A6329-F79D-DC98-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02580000 +// Image base: 0x00790000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl index 6b3d791577d..39def210b7f 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest5.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000280 Length: 0x000000AF } .module ListExpressionSteppingTest5.exe -// MVID: {5B9A68C1-CBE3-BFEA-A745-0383C1689A5B} +// MVID: {5B9A6329-CBE3-BFEA-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02900000 +// Image base: 0x027C0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl index c60dfb3a9c2..2d43c04e954 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/ListExpressionStepping/ListExpressionSteppingTest6.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x000002A8 Length: 0x000000BC } .module ListExpressionSteppingTest6.exe -// MVID: {5B9A68C1-98A2-AB14-A745-0383C1689A5B} +// MVID: {5B9A6329-98A2-AB14-A745-038329639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02AC0000 +// Image base: 0x007B0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl index e759337b5a9..b26df9510b4 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation02.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:3:0 + .ver 4:5:0:0 } .assembly Mutation02 { @@ -36,13 +36,13 @@ // Offset: 0x000001A8 Length: 0x0000006C } .module Mutation02.exe -// MVID: {5B17FC4F-8C6A-2F0D-A745-03834FFC175B} +// MVID: {5B9A632A-8C6A-2F0D-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00960000 +// Image base: 0x02750000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl index 8ddc6e057a8..e43810c10bf 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation03.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:3:0 + .ver 4:5:0:0 } .assembly Mutation03 { @@ -36,13 +36,13 @@ // Offset: 0x000001A8 Length: 0x0000006C } .module Mutation03.exe -// MVID: {5B17FC4F-8C6A-2EEC-A745-03834FFC175B} +// MVID: {5B9A632A-8C6A-2EEC-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02DC0000 +// Image base: 0x02CA0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl index bba133af308..444d581fc63 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation04.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:3:0 + .ver 4:5:0:0 } .assembly Mutation04 { @@ -36,13 +36,13 @@ // Offset: 0x000001C0 Length: 0x0000006C } .module Mutation04.exe -// MVID: {5B17FC4F-8C6A-2E43-A745-03834FFC175B} +// MVID: {5B9A632A-8C6A-2E43-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02A70000 +// Image base: 0x02A80000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl index 943de9e5f70..fc052bb6e08 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Mutation/Mutation05.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:3:0 + .ver 4:5:0:0 } .assembly Mutation05 { @@ -36,13 +36,13 @@ // Offset: 0x000004D8 Length: 0x00000127 } .module Mutation05.exe -// MVID: {5B17FC4F-8C6A-2E22-A745-03834FFC175B} +// MVID: {5B9A632A-8C6A-2E22-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00FA0000 +// Image base: 0x008E0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl index 49f15aaf6f3..78bfe96fcc7 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Aggregates01.il.bsl @@ -45,13 +45,13 @@ // Offset: 0x00000618 Length: 0x00000211 } .module Linq101Aggregates01.exe -// MVID: {5B9A68C1-D281-4783-A745-0383C1689A5B} +// MVID: {5B9A632A-D281-4783-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02B50000 +// Image base: 0x026B0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl index 7bff92400bb..b0aa6e961a6 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101ElementOperators01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x00000390 Length: 0x00000127 } .module Linq101ElementOperators01.exe -// MVID: {5B9A68C1-19D7-C20D-A745-0383C1689A5B} +// MVID: {5B9A632A-19D7-C20D-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02C90000 +// Image base: 0x028F0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl index 56e7ab5aad8..79848765473 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Ordering01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x000003C0 Length: 0x00000134 } .module Linq101Ordering01.exe -// MVID: {5B9A68C1-649A-6956-A745-0383C1689A5B} +// MVID: {5B9A632A-649A-6956-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00900000 +// Image base: 0x00AD0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl index 0634ea8c7de..b210d7f3c90 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Partitioning01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x000003E8 Length: 0x00000138 } .module Linq101Partitioning01.exe -// MVID: {5B9A68C1-B280-A6A2-A745-0383C1689A5B} +// MVID: {5B9A632A-B280-A6A2-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02900000 +// Image base: 0x00AF0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl index 6a4255f7c34..d2b715c5820 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Quantifiers01.il.bsl @@ -45,13 +45,13 @@ // Offset: 0x000003A8 Length: 0x000000FF } .module Linq101Quantifiers01.exe -// MVID: {5B9A68C1-76DD-E373-A745-0383C1689A5B} +// MVID: {5B9A632A-76DD-E373-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02970000 +// Image base: 0x025D0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl index 74cd2dfacd3..8afae23a726 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Select01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x00000668 Length: 0x00000204 } .module Linq101Select01.exe -// MVID: {5B9A68C1-6057-8F80-A745-0383C1689A5B} +// MVID: {5B9A632A-6057-8F80-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00BB0000 +// Image base: 0x00FF0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl index 8747e407c11..7b308ef661d 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x000003A0 Length: 0x0000011E } .module Linq101SetOperators01.exe -// MVID: {5B9A68C1-4EE5-349F-A745-0383C1689A5B} +// MVID: {5B9A632A-4EE5-349F-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02530000 +// Image base: 0x026A0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl index 2c3968029b9..b673d1193cc 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Where01.il.bsl @@ -40,13 +40,13 @@ // Offset: 0x000003E0 Length: 0x0000012E } .module Linq101Where01.exe -// MVID: {5B9A68C1-FF23-CD21-A745-0383C1689A5B} +// MVID: {5B9A632A-FF23-CD21-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x007B0000 +// Image base: 0x009E0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl index b1204f81b33..0af7608e807 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest5.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000278 Length: 0x000000AD } .module SeqExpressionSteppingTest5.exe -// MVID: {5B9A68C1-2432-9401-A745-0383C1689A5B} +// MVID: {5B9A632A-2432-9401-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00670000 +// Image base: 0x026A0000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl index aa5869480f0..d06d692b20b 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest6.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x000002A8 Length: 0x000000BA } .module SeqExpressionSteppingTest6.exe -// MVID: {5B9A68C1-2432-94A2-A745-0383C1689A5B} +// MVID: {5B9A632A-2432-94A2-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00F20000 +// Image base: 0x01330000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl index 73f16839efc..ae9e2337813 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest7.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000278 Length: 0x00000098 } .module SeqExpressionSteppingTest7.exe -// MVID: {5B9A68C1-2432-93C3-A745-0383C1689A5B} +// MVID: {5B9A632A-2432-93C3-A745-03832A639A5B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x00660000 +// Image base: 0x02450000 // =============== CLASS MEMBERS DECLARATION =================== diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl index c9d066af0ea..aa7bbc68da5 100644 --- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl +++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals02.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 + .ver 4:4:3:0 } .assembly Equals02 { @@ -29,20 +29,20 @@ } .mresource public FSharpSignatureData.Equals02 { - // Offset: 0x00000000 Length: 0x00000234 + // Offset: 0x00000000 Length: 0x0000023C } .mresource public FSharpOptimizationData.Equals02 { - // Offset: 0x00000238 Length: 0x000000B6 + // Offset: 0x00000240 Length: 0x000000B6 } .module Equals02.dll -// MVID: {59B18AEE-0759-B6D8-A745-0383EE8AB159} +// MVID: {5B18753B-0759-B6D8-A745-03833B75185B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x02880000 +// Image base: 0x00F20000 // =============== CLASS MEMBERS DECLARATION =================== @@ -68,51 +68,32 @@ .line 8,8 : 8,32 '' IL_0002: ldc.i4.0 IL_0003: stloc.1 - IL_0004: br.s IL_0022 - + IL_0004: br.s IL_001a .line 9,9 : 12,26 '' - IL_0006: ldc.i4.1 - IL_0007: brfalse.s IL_001b - - .line 16707566,16707566 : 0,0 '' - IL_0009: ldstr "five" - IL_000e: ldstr "5" - IL_0013: call bool [mscorlib]System.String::Equals(string, + IL_0006: ldstr "five" + IL_000b: ldstr "5" + IL_0010: call bool [mscorlib]System.String::Equals(string, string) - .line 16707566,16707566 : 0,0 '' - IL_0018: nop - IL_0019: br.s IL_001d - - .line 16707566,16707566 : 0,0 '' - IL_001b: ldc.i4.0 - .line 16707566,16707566 : 0,0 '' - IL_001c: nop - .line 16707566,16707566 : 0,0 '' - IL_001d: stloc.0 - IL_001e: ldloc.1 - IL_001f: ldc.i4.1 - IL_0020: add - IL_0021: stloc.1 + IL_0015: stloc.0 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.1 .line 8,8 : 8,32 '' - IL_0022: ldloc.1 - IL_0023: ldc.i4 0x989681 - IL_0028: blt.s IL_0006 - + IL_001a: ldloc.1 + IL_001b: ldc.i4 0x989681 + IL_0020: blt.s IL_0006 .line 10,10 : 8,9 '' - IL_002a: ldloc.0 - IL_002b: ret + IL_0022: ldloc.0 + IL_0023: ret } // end of method EqualsMicroPerfAndCodeGenerationTests::f4_tuple4 - } // end of class EqualsMicroPerfAndCodeGenerationTests - } // end of class Equals02 - .class private abstract auto ansi sealed ''.$Equals02$fsx extends [mscorlib]System.Object { } // end of class ''.$Equals02$fsx - // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl index de03157c58f..e222d314825 100644 --- a/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl +++ b/tests/fsharpqa/Source/Optimizations/GenericComparison/Equals03.il.bsl @@ -13,7 +13,7 @@ .assembly extern FSharp.Core { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 4:4:1:0 + .ver 4:4:3:0 } .assembly Equals03 { @@ -29,20 +29,20 @@ } .mresource public FSharpSignatureData.Equals03 { - // Offset: 0x00000000 Length: 0x00000234 + // Offset: 0x00000000 Length: 0x0000023C } .mresource public FSharpOptimizationData.Equals03 { - // Offset: 0x00000238 Length: 0x000000B6 + // Offset: 0x00000240 Length: 0x000000B6 } .module Equals03.dll -// MVID: {59B18AEE-0759-3313-A745-0383EE8AB159} +// MVID: {5B18753B-0759-3313-A745-03833B75185B} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x010B0000 +// Image base: 0x02630000 // =============== CLASS MEMBERS DECLARATION =================== @@ -57,7 +57,7 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) .method public static bool f4_tuple5() cil managed { - // Code size 71 (0x47) + // Code size 63 (0x3f) .maxstack 4 .locals init ([0] bool x, [1] int32 i) @@ -68,54 +68,41 @@ .line 8,8 : 8,32 '' IL_0002: ldc.i4.0 IL_0003: stloc.1 - IL_0004: br.s IL_003d + IL_0004: br.s IL_0035 .line 9,9 : 12,26 '' - IL_0006: ldc.i4.1 - IL_0007: brfalse.s IL_001b - - .line 16707566,16707566 : 0,0 '' - IL_0009: ldstr "5" - IL_000e: ldstr "5" - IL_0013: call bool [mscorlib]System.String::Equals(string, + IL_0006: ldstr "5" + IL_000b: ldstr "5" + IL_0010: call bool [mscorlib]System.String::Equals(string, string) - .line 16707566,16707566 : 0,0 '' - IL_0018: nop - IL_0019: br.s IL_001d - - .line 16707566,16707566 : 0,0 '' - IL_001b: ldc.i4.0 - .line 16707566,16707566 : 0,0 '' - IL_001c: nop - .line 16707566,16707566 : 0,0 '' - IL_001d: brfalse.s IL_0036 + IL_0015: brfalse.s IL_002e .line 16707566,16707566 : 0,0 '' - IL_001f: ldc.r8 6. - IL_0028: ldc.r8 7. - IL_0031: ceq + IL_0017: ldc.r8 6. + IL_0020: ldc.r8 7. + IL_0029: ceq .line 16707566,16707566 : 0,0 '' - IL_0033: nop - IL_0034: br.s IL_0038 + IL_002b: nop + IL_002c: br.s IL_0030 .line 16707566,16707566 : 0,0 '' - IL_0036: ldc.i4.0 + IL_002e: ldc.i4.0 .line 16707566,16707566 : 0,0 '' - IL_0037: nop + IL_002f: nop .line 16707566,16707566 : 0,0 '' - IL_0038: stloc.0 - IL_0039: ldloc.1 - IL_003a: ldc.i4.1 - IL_003b: add - IL_003c: stloc.1 + IL_0030: stloc.0 + IL_0031: ldloc.1 + IL_0032: ldc.i4.1 + IL_0033: add + IL_0034: stloc.1 .line 8,8 : 8,32 '' - IL_003d: ldloc.1 - IL_003e: ldc.i4 0x989681 - IL_0043: blt.s IL_0006 + IL_0035: ldloc.1 + IL_0036: ldc.i4 0x989681 + IL_003b: blt.s IL_0006 .line 10,10 : 8,9 '' - IL_0045: ldloc.0 - IL_0046: ret + IL_003d: ldloc.0 + IL_003e: ret } // end of method EqualsMicroPerfAndCodeGenerationTests::f4_tuple5 } // end of class EqualsMicroPerfAndCodeGenerationTests diff --git a/tests/scripts/compiler-perf-results.txt b/tests/scripts/compiler-perf-results.txt index ca0bc0007cf..95569656cf9 100644 --- a/tests/scripts/compiler-perf-results.txt +++ b/tests/scripts/compiler-perf-results.txt @@ -156,6 +156,10 @@ https://github.com/dsyme/visualfsharp.git minvars 129c600ea https://github.com/Microsoft/visualfsharp master b99f487554dec970c841e5fcea5d7ccd2f09216e b99f487554dec970c841e5fcea5d7ccd2f09216e MSRC-3617253 251.13 9.99 34.60 45.46 55.57 57.79 https://github.com/dsyme/visualfsharp.git minvars 129c600eaac62a976377c3c668870dde39a7f1f3 b99f487554dec970c841e5fcea5d7ccd2f09216e MSRC-3617253 250.22 10.06 34.46 44.80 55.67 57.95 https://github.com/Microsoft/visualfsharp master b99f487554dec970c841e5fcea5d7ccd2f09216e b99f487554dec970c841e5fcea5d7ccd2f09216e MSRC-3617253 249.94 9.93 34.61 45.32 56.05 57.91 +https://github.com/dsyme/visualfsharp.git bool2 00e6d6240f143cbc1bd4e6ca487928078306e6ab b224a2d7fdbb34daee771bbeb4826b2529d94621 MSRC-3617253 256.11 10.80 38.68 39.34 49.56 57.59 +https://github.com/dsyme/visualfsharp.git opt5 655dd7c2fccd09d96dd0bbc2f9146ef863a64b04 b224a2d7fdbb34daee771bbeb4826b2529d94621 MSRC-3617253 252.46 9.65 34.04 44.59 56.20 58.46 +https://github.com/dsyme/visualfsharp.git minvars 129c600eaac62a976377c3c668870dde39a7f1f3 b224a2d7fdbb34daee771bbeb4826b2529d94621 MSRC-3617253 250.99 9.67 34.16 44.58 56.34 58.39 +https://github.com/Microsoft/visualfsharp master b224a2d7fdbb34daee771bbeb4826b2529d94621 b224a2d7fdbb34daee771bbeb4826b2529d94621 MSRC-3617253 253.33 9.75 34.20 44.52 55.79 58.05 https://github.com/dsyme/visualfsharp.git bool2 1212562a6551e6854f320d8600a9cf6146aee681 59d48cf44a26830793cd1c9c0a1b0d28bd34adef MSRC-3617253 250.26 9.87 34.23 44.49 54.95 58.06 https://github.com/dsyme/visualfsharp.git opt5 655dd7c2fccd09d96dd0bbc2f9146ef863a64b04 59d48cf44a26830793cd1c9c0a1b0d28bd34adef MSRC-3617253 249.45 9.89 33.94 45.48 56.10 57.95 https://github.com/dsyme/visualfsharp.git minvars 129c600eaac62a976377c3c668870dde39a7f1f3 59d48cf44a26830793cd1c9c0a1b0d28bd34adef MSRC-3617253 248.60 9.64 34.27 44.60 55.56 58.64