summaryrefslogtreecommitdiff
path: root/src/jit/earlyprop.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-08-31Add missing BBF_HAS_NULLCHECK testPetr Onderka1-0/+5
2016-08-31Removed unused variablePetr Onderka1-1/+0
2016-08-18Preparatory changes for Blk Ops IRCarol Eidt1-1/+5
These are mostly refactoring changes, in preparation for the change to the IR for block assignments.
2016-08-12Reformat the JIT sources.Pat Gavlin1-64/+65
The sources were formatted using jit-format on Windows with the following command lines in the following order: `jit-format.cmd -o Windows -b Checked -a x64 -f` `jit-format.cmd -o Windows -b Debug -a x64 -f` `jit-format.cmd -o Windows -b Release -a x64 -f` The versions of clang-format and clang-tidy that were invoked by jit-format were: clang-format version 3.8.1 (branches/release_38) LLVM (http://llvm.org/): LLVM version 3.8.1 Optimized build with assertions. Built Jun 22 2016 (12:19:56). Default target: x86_64-pc-windows-msvc Host CPU: sandybridge
2016-08-12Revert #6686.Pat Gavlin1-66/+65
The code was accidentally formatted with Clang 3.9. It will be reformatted with Clang 3.8 and a new PR submitted.
2016-08-11Reformat jit sources with clang-tidy and formatMichelle McDaniel1-65/+66
This change is the result of running clang-tidy and clang-format on jit sources.
2016-08-10Propagate known array lengths to more placesJoseph Tremoulet1-1/+1
Earlyprop limits its propagation of array lengths to blocks marked BBF_HAS_INDX, for throughput reasons. The importer sets that flag on blocks that store/load array elements, but not blocks that simply extract an array's length. This change renames the flag to BBF_HAS_IDX_LEN, and updates the importer to set it also on blocks with ldlen operations. This change also updates fgOptWhileLoop to propagate the flag when it copies such an expression as part of a zero-trip test. Fixes #2325.
2016-08-09Update FieldSeq annotations in EarlyPropJoseph Tremoulet1-0/+9
When morph expands `ldelem`s, it annotates local vars and int constants that contribute linearly to the index. When value-numbering runs, ParseArrayAddress must still be able to discover annotations. EarlyProp runs between morph and value-numbering, and might replace a `ldlen` that happens to be in an array index expression with a constant. This change updates EarlyProp to call LabelIndex in such cases to annotate the constants appropriately for their new context. In order to ensure that EarlyProp can determine whether a replacement is in an array index context or not, this change also adds a new flag `GTF_ARRLEN_ARR_IDX`, which LabelIndex sets on GT_ARR_LENGTH nodes and EarlyProp can subsequently check. Fixes #6649.
2016-08-05Null check folding.Eugene Rozenfeld1-19/+239
1. Added a null check folding optimization to early prop. The optimization tries to fold GT_NULLCHECK(y) nodes into GT_IND(x) nodes where x=y+const in the same block (where const is sufficiently small). The algorithm uses SSA use-def info to go from x to its def and then tries to match the pattern x = COMMA(NULLCHECK(y), ADD(y, const))). If such a pattern is found, the algorithm checks the trees and statements that are between the use and the def in execution order to see if they have unsafe side effects: calls, exception sources, and assignments (all assignment if we are in a try and assignments to global memory if we are not). If there are no nodes with unsafe side effects, the null check is removed. 2. Made several improvements to null check elimination in assertion propagation. ..* Added a new kind for op1: O1K_VALUE_NUMBER ..* Non-null assertions can now be made about arbitrary value numbers, not just locals ..* Fixed code that was trying to find a ref given a byref: the code now handles an arbitrary number of offsets and checks whether the total offsetof is small enough. ..* Added similar code that tries to find a ref VN given a byref VN This addresses part of the suboptimal code generated for #1226: null check is no longer emitted. Correctness: ran full desktop and CoreCLR testing. Throughput: no measurable throughput impact (verified by running internal CQNgenTP several times). Code size in CoreCLR: Framework assemblies: Total bytes of diff: -805 (-0.01 % of base) diff is an improvement. Total byte diff includes 0 bytes from reconciling methods Base had 0 unique methods, 0 unique bytes Diff had 0 unique methods, 0 unique bytes Top file improvements by size (bytes): -352 : System.Private.CoreLib.dasm (-0.01 % of base) -306 : Microsoft.CodeAnalysis.CSharp.dasm (-0.01 % of base) -58 : Microsoft.CodeAnalysis.dasm (-0.01 % of base) -48 : System.Numerics.Vectors.dasm (-0.08 % of base) -14 : System.Xml.XmlDocument.dasm (-0.01 % of base) 7 total files with size differences. Top method improvements by size (bytes): -30 : System.Numerics.Vectors.dasm - System.Numerics.Matrix4x4:ToString():ref:this -30 : System.Private.CoreLib.dasm - System.DateTimeParse:ParseByFormat(byref,byref,byref,ref,byref):bool -24 : Microsoft.CodeAnalysis.CSharp.dasm - <GetMethodsToEmit>d__68:MoveNext():bool:this -18 : System.Private.CoreLib.dasm - System.DateTimeParse:Lex(int,byref,byref,byref,byref,byref,int):bool -18 : System.Private.CoreLib.dasm - System.DateTimeParse:ProcessDateTimeSuffix(byref,byref,byref):bool 243 total methods with size differences. JIT Code quality benchmarks in CoreCLR: Total bytes of diff: -29 (-0.01 % of base) diff is an improvement. Total byte diff includes 0 bytes from reconciling methods Base had 0 unique methods, 0 unique bytes Diff had 0 unique methods, 0 unique bytes Top file improvements by size (bytes): -25 : Bytemark\Bytemark\Bytemark.dasm (-0.03 % of base) -4 : BenchmarksGame\pidigits\pi-digits\pi-digits.dasm (-0.21 % of base) 2 total files with size differences. Top method improvements by size (bytes): -9 : Bytemark\Bytemark\Bytemark.dasm - AssignJagged:second_assignments(ref,ref) -6 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:MultiplyInternalFPF(byref,byref,byref) -4 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:AddSubInternalFPF(ubyte,byref,byref,byref) -2 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:denormalize(byref,int) -2 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:DivideInternalFPF(byref,byref,byref) 8 total methods with size differences. In internal SPMI: 3915 methods with diffs, almost everything -- code size improvements 13,715 bytes code size reduction overall 0.51% on affected methods CQ_Perf: 85 methods with diffs, 84 code size improvements, no regressions Benchmarks with code size diffs: Roslyn 59 TrueTypeBench 19 mono-pi-digits 2 mono-chameneos-redux 2 ByteMark\assign_jagged 1 Json_Serialize 1 SharpChess 1 BenchI\mulmtx 1 Internal CQPerf didn't report any runtime wins for these benchmarks.
2016-07-26Rewrite gtIsVtableAccess to avoid assertAndy Ayers1-7/+6
Calling `HasIndex` from `gtIsVtableAccess` can leads to asserts as the underly code checks to see if the addressing sub-expressions are contained. But earlyProp runs early enough that it is not concerned with containment. The code just needs to verify that there is a ref type base and no index. Rework the code to do the checks directly.
2016-01-27Update license headersdotnet-bot1-4/+3
2016-01-03Remove dead code from JIT's earlyprop.cppMike Danes1-4/+0
2015-12-14Don't propagate type handles that are used as null checksBruce Forstall1-0/+10
In order not to change program behavior, don't propagate type handles that are used as null checks, which are usually in form of * stmtExpr void (top level) \--* indir int \--* lclVar ref V02 loc0 [tfs-changeset: 1557281]
2015-12-11Port of all JIT changes for .NET Framework 4.6.1 changesBrian Sullivan1-0/+433
http://blogs.msdn.com/b/dotnet/archive/2015/11/30/net-framework-4-6-1-is-now-available.aspx .NET Framework list of changes in 4.6.1 https://github.com/Microsoft/dotnet/blob/master/releases/net461/dotnet461-changes.md Additional changes including - Working ARM64 JIT compiler - Additional JIT Optimizations o Tail call recursion optimization o Array length tracking optimization o CSE for widening casts o Smaller encoding for RIP relative and absolute addresses in addressing modes o Tracked Local Variable increased to 512 o Improved handling of Intrinsics System.GetType() o Improved handling of Math intrinsics - Work for the X86 Ryu-JIT compiler [tfs-changeset: 1557101]