Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-06-26Extract fgMorph(Init/Copy)Block into their own classes. (#53983)Sergey Andreenko
* Rewrite fgMorph(Copy/Init)Block. * fix a last squash error. * fix nits
2021-06-08Add more iterators to JIT (#52515)Bruce Forstall
Add more iterators compatible with range-based `for` syntax for various data structures. These iterators all assume (and some check) that the underlying data structures determining the iteration are not changed during the iteration. For example, don't use these to iterate over the predecessor edges if you are changing the order or contents of the predecessor edge list. - BasicBlock: iterate over all blocks in the function, a subset starting not at the first block, or a specified range of blocks. Removed uses of the `foreach_block` macro. E.g.: ``` for (BasicBlock* const block : Blocks()) // all blocks in function for (BasicBlock* const block : BasicBlockSimpleList(fgFirstBB->bbNext)) // all blocks starting at fgFirstBB->bbNext for (BasicBlock* const testBlock : BasicBlockRangeList(firstNonLoopBlock, lastNonLoopBlock)) // all blocks in range (inclusive) ``` - block predecessors: iterate over all predecessor edges, or all predecessor blocks, e.g.: ``` for (flowList* const edge : block->PredEdges()) for (BasicBlock* const predBlock : block->PredBlocks()) ``` - block successors: iterate over all block successors using the `NumSucc()/GetSucc()`, or `NumSucc(Compiler*)/GetSucc(Compiler*)` pairs, e.g.: ``` for (BasicBlock* const succ : Succs()) for (BasicBlock* const succ : Succs(compiler)) ``` Note that there already exists the "AllSuccessorsIter" which iterates over block successors including possible EH successors, e.g.: ``` for (BasicBlock* succ : block->GetAllSuccs(m_pCompiler)) ``` - switch targets, (namely, the successors of `BBJ_SWITCH` blocks), e.g.: ``` for (BasicBlock* const bTarget : block->SwitchTargets()) ``` - loops blocks: iterate over all the blocks in a loop, e.g.: ``` for (BasicBlock* const blk : optLoopTable[loopInd].LoopBlocks()) ``` - Statements: added an iterator shortcut for the non-phi statements, e.g.: ``` for (Statement* const stmt : block->NonPhiStatements()) ``` Note that there already exists an iterator over all statements, e.g.: ``` for (Statement* const stmt : block->Statements()) ``` - EH clauses, e.g.: ``` for (EHblkDsc* const HBtab : EHClauses(this)) ``` - GenTree in linear order (but not LIR, which already has an iterator), namely, using the `gtNext` links, e.g.: ``` for (GenTree* const call : stmt->TreeList()) ``` This is a no-diff change.
2021-05-19JIT: peel off dominant switch case under PGO (#52827)Andy Ayers
If we have PGO data and the dominant non-default switch case has more than 55% of the profile, add an explicit test for that case upstream of the switch. We don't see switches all that often anymore as CSC is quite aggressive about turning them into if-then-else trees, but they still show up in the async methods.
2021-05-15Improve flow graph DOT dumps (#52787)Bruce Forstall
1. Introduce `COMPlus_JitFgDumpPrePhase`. This is analogous to the existing `COMPlus_JitFgDumpPhase`, but to dump before a phase, not after. It takes a set of short phase names, and dumps the flow graph before each of those phases. E.g., to dump both before and after just loop cloning, you don't need to figure out which phase comes before loop cloning, you can specify: ``` set COMPlus_JitDumpFgPhase=LP-CLONE set COMPlus_JitDumpFgPrePhase=LP-CLONE ``` 2. Interpret array length node type in BBJ_COND blocks, e.g., `V01.Length <= V03`.
2021-05-13Replacing `BOOL` with `bool` (#52585)WhiteBlackGoose
* Replaces all BOOL to bool in RyuJIT Replaced all Windows' BOOL to bool in RyuJIT except for WIN API related cases. Fix #48317 * Replaced `TRUE` and `FALSE` constants Replaced `TRUE` with `true` and `FALSE` with `false` constants in RyuJIT except Windows-specific cases. * A couple of BOOLs replaced to bool * Format issue fixed Formatting patch applied according to the instruction.
2021-05-12Introduce enum for BasicBlock and loop flags (#52410)Bruce Forstall
* Introduce enum for BasicBlock and loop flags This gives a better debugging experience in Visual Studio. It also improves type checking: there were a few places still using `unsigned` instead of `unsigned __int64` when manipulating BasicBlock flags. * Make sure debugreturn and contracts are disabled for the JIT build * Convert GenTree flags, debug flags, and call flags to enums * Remove bad GT_HWINTRINSIC copy/paste code from GenTree::GetRegSpillFlagByIdx
2021-05-08Improve flow graph DOT dump: conditional display, block ID (#52489)Bruce Forstall
1. For conditional blocks, display a small summary of the branch taken path of the block (namely, the JTRUE condition). This is currently very limited, but could be expanded to additional cases as it proves useful (but it needs to be very compact; you're expected to consult the JitDump for more details). 2. Optionally display both the bbNum and bbID as the block label. This makes it easier to see which blocks remained the same through renames if comparing flow graph displays from different phases. This is enabled by setting `COMPlus_JitDumpFgBlockID=1`.
2021-05-06Improve DOT flow graph dumping (#52329)Bruce Forstall
1. Do not include EH and Loop regions in the graph for inlinees. The data required for them is not valid in the inlinee compiler. 2. Do not include Loop regions in phases starting with the rationalizer. The loop table is not maintained, and decays, but we don't ever mark it as invalid. This is an arbitrary point after which it seems to be unmaintained (and can lead to asserts when using it). 3. Add the text "(inlinee)" to the function name in inlinee graph output, to distinguish it. 4. Fix a bug where the block map was using incorrect block number count for inlinees. 5. Fix a region insert bug when inserting a parent region after a child region where they share the end block (but the parent start block is earlier than the child). This happens in some EH region tables. Added some comments about all the different forms of region that need to be handled. 6. Add a `Verify` function to validate the constructed region tree. 7. Stop adding removed loops to the output.
2021-04-24Don't recompute preds lists during loop cloning (#51757)Bruce Forstall
Instead, add and modify the appropriate preds when the mechanical cloning is performed. This will preserve existing profile data on the edges. Contributes to #49030 No x86/x64 SPMI asm diffs.
2021-04-16Flow graph "dot" graph output improvements (#51357)Bruce Forstall
* Flow graph "dot" graph output improvements Added optional support for adding EH regions and loops in the loop table to the ".dot" format flow graph display. To enable one or both of these, use: ``` set COMPlus_JitDumpFgEH=1 set COMPlus_JitDumpFgLoops=1 ``` Also, I added a config variable to allow disabling the use of "invisible" edges that forces the graph to be in mostly lexical linear order in the layout. To use this, use: ``` set COMPlus_JitDumpFgConstrained=0 ``` (COMPlus_JitDumpFgConstrained=1 is the default.) * Remove trailing newlines from block label
2021-04-13Improve flowgraph xml/dot dumping (#51082)Bruce Forstall
* Improve flowgraph xml/dot dumping 1. Decouple it from JitDump 2. Add some documentation, including a useful link to https://sketchviz.com/ 3. Fix DUMP_FLOWGRAPHS Release build 4. Fix some xml dumping issues 5. Replace custom function pattern parsing with CONFIG_METHODSET ".contains" function 6. Make dot format the default (instead of xml) Fixes #43712 * Code review feedback: use `getCalledCount`
2021-03-24JIT: Add rootTreeOp to DumpFg (#50119)Egor Bogatov
2021-03-24JIT: Fold null checks against initialized static readonly fields (#50000)Egor Bogatov
Co-authored-by: Andy Ayers <andya@microsoft.com> Co-authored-by: Sergey Andreenko <seandree@microsoft.com>
2021-03-24Comments and cleanup for loop cloning (#49768)Bruce Forstall
* Comments and cleanup for loop cloning This is a no-diff change Added various comments to document loop cloning. Standardized and improved some logging. Consolidated more loop cloning condition checking into `optIsLoopClonable` that was previously in `optIdentifyLoopOptInfo`. Replaced some `0` weights with `BB_ZERO_WEIGHT`. Made FMT_BB use pervasive. * Review feedback Added FMT_LP formatting string. Cached often-used `optLoopTable[loopInd]` expression. Added `const` to many loop query member functions. Added static `GenTree::OperIs(compareOper, oper, oper, oper...)` functions for simplifying oper check expressions where the compareOper isn't from a GenTree node `OperGet()`. (This doesn't need to be part of GenTree, but it doesn't hurt, either.) Added a few more comments. * Fix static OperIs Rename to StaticOperIs. It appears the compiler uses the wrong template in some cases, but doesn't complain about duplicate options, leading to run-time failures.
2021-03-19Fix or disable warnings on latest VS dogfood (#49799)Jan Kotas
* Fix or disable warnings on latest VS dogfood * Delete JIT local warning disables
2021-02-18Add debug checking of the loop table (#48060)SingleAccretion
* Add fgDebugCheckLoopTable() * Minify some logging * Add checking of the loop table to some phases * Ignore removed loops in fgDebugCheckLoopTable
2021-02-16Expand Virtual Call targets earlier in Morph and allow CSE of the ↵Brian Sullivan
indirections (#47808) * Added GTF_CALL_M_EXPANDED_EARLY to flag virtual calls that should be expanded early during fgMorph Added COMPlus_JitExpandCallsEarly variable to enable virtual calls to be expanded early on a per method basis Set opts.compExpandCallsEarly to true when we are optimizing and have COMPlus_JitExpandCallsEarly enabled Update gtSetEvalOrder to also include the call->gtControlExpr Update morph to call fgExpandVirtualVtableCallTarget when we are expanding early Update lower to not call LowerVirtualVtableCall when we have already expanded it early Modify CheckTreeId to print the duplicated gtTreeID before it asserts. All tests are passing when using COMPLUS_JitExpandCallsEarly=* Expand the Virtual Call target after we morph the args Fix an inadvertent change in the GT_CALL weights * Changed the default for Virtual calls to be expanded early in Morph Use COMPlus_JitExpandCallsEarly=0 to disable and use old behavior * Code Review feedback Added comment stating the the isRelative code path is never executed * Fixes for propagating gtControlExpr->gtFlags * Fix a few code size regressions when we perform a tail call * Tailcall lower fix * Code Review changes * Fixes for the TAILCALL_HELPER path for x86 * Address the Arm/Linux failure
2021-01-26JIT: split up some parts of flowgraph.cpp (#47072)Andy Ayers
Create a number of smaller files with cohesive sets of methods.