summaryrefslogtreecommitdiff
path: root/src/jit/assertionprop.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-06-19Fix Issue #25134 - AssertionProp incorrectly removes cast from uintBrian Sullivan1-8/+28
Add additional check for the GT_UNSIGNED flag + Ran clang-format + Code review feedback, use IsUnsigned()
2019-04-26Fix the case when we replace `stmt->gtStmtExpr`.Sergey Andreenko1-2/+11
2019-04-26Use `ReplaceOperand`.Sergey Andreenko1-24/+5
2019-04-25Fix parent's links in fgArgInfo in optAssertionProp_Update.Sergey Andreenko1-0/+20
2019-04-25Change gtFindLink to return parent as well.Sergey Andreenko1-1/+2
2019-04-16Arm64 vector ABI (#23675)Carol Eidt1-1/+1
* Support for Arm64 Vector ABI Extend HFA support to support vectors as well as floating point types. This requires that the JIT recognize vector types even during crossgen, so that the ABI is supported consistently. Also, fix and re-enable the disabled Arm64 Simd tests. Fix #16022
2019-04-10Update the comment.Sergey Andreenko1-4/+1
2019-04-10Change optExtractSideEffList to optExtractSideEffList.Sergey Andreenko1-59/+36
2019-04-09Clarify some unsupported cases in `optVNConstantPropOnTree`.Sergey Andreenko1-10/+15
2019-04-09Clean optVNConstantPropOnTree.Sergey Andreenko1-65/+41
Create a new tree with const val and attach side-effects to it. Extract common code and delete returns in the of the switch.
2019-04-09Destroy the old tree in `optAssertionProp_Update`.Sergey Andreenko1-0/+2
Currently compiletion will fail with an assert because of `optPrepareTreeForReplacement`.
2019-04-09Delete condition that was previously checked with noway_assert.Sergey Andreenko1-22/+10
2019-03-29Use GenTreeStmt* where it is implied. (#22963)Sergey Andreenko1-63/+57
* Extract `impAppendStmt` and `impExtractLastStmt`. * Delete `BEG_STMTS` fake stmt. Use new functions to keep the list updated. * Retype `impTreeList` and `impTreeLast` as statements. Rename `impTreeList` and `impTreeLast` to show that they are statements. * Fix fields that have to be stmt. * Start using GenTreeStmt. Change `optVNAssertionPropCurStmt` to use GenTreeStmt. Replace `GenTree* stmt = block->bbTreeList` with `GenTreeStmt* stmt = block->firstStmt()`. Save results of `FirstNonPhiDef` as `GenTreeStmt`. * Replace do-while with for loop. * Change type inside VNAssertionPropVisitorInfo. * Delete unused args fron `optVNConstantPropOnTree`. * Update fields to be stmt. Update optVNConstantPropCurStmt to use Stmt. Change `lvDefStmt` to stmt. Update LoopCloning structs. Update `optDebugLogLoopCloning`. Make `compCurStmt` a statement. Update declaration name in `BuildNode`. * Clean simple cpp files. Clean valuenum. Clean ssabuilder. Clean simd. Clean optcse. Clean loopcloning. Clean copyprop. Clean optimizer part1. * Start cleaning importer, morph, flowgraph, gentree. * Continue clean functons. Clean assertionprop. Clean morph. Clean gentree. Clean flowgraph. Clean compiler. Clean rangecheck. Clean indirectcalltransofrmer. Clean others. * Create some temp stmt. * Delete unnecessary noway_assert and casts. * Init `impStmtList` and `impLastStmt` in release. * Response review 1.
2019-03-22Delete unused variables in jit. Part1. (#23399)Sergey Andreenko1-12/+1
* Clean `assertionprop.cpp`. * Clean `codegencommon.cpp`.: * Clean `codegenlinear.cpp`. * Clean `compiler.cpp`. * Clean `earlyprop.cpp`. * Clean `gschecks.cpp`. * Clean 'lclvars.cpp`. * Clean `jiteh.cpp`. * Clean `liveness.cpp`. * Clean `hashbv.cpp`. * Clean `gcinfo.cpp`. * Clean `optimizer.cpp`.
2019-03-06JIT: fix issue with assertion prop on isinst helpers (#23056)Andy Ayers1-1/+13
For calls to isinst helpers, morph may rearrange the order of args on the late arg list, so examine the operands to ensure the right ones are passed into the assertion creation code. Added simplified test case. Closes #23039.
2019-03-04JIT: remove unneeded ref count updating traversal from optimizer (#22954)Andy Ayers1-6/+2
The ref count update traversal in the optimizer is not doing anything, so remove it. This was overlooked when we changed away from incremental updates in #19345. Also: fix up comments and documentation to reflect the current approach to local var ref counts.
2019-02-26Fix `optVNConstantPropOnTree`. (#22865)Sergey Andreenko1-2/+3
It should use the same VN that `optVNConstantPropOnTree` uses. Without this fix `optVNConstantPropOnTree` was doing nothing.
2019-01-11Generate non-null assertion for byrefs if we can't find corresponding refs.Eugene Rozenfeld1-2/+3
When we have a non-null fact about a byref, we try to find the corresponding ref and generate an assertion about the ref. Then it can be used on byrefs if the offset is not too big. We use both trees and value numbers to find the ref. When the ref wasn't found we bailed on generating the assertion. I found that we get a number of good diffs if we generate assertions for byrefs when refs can't be found so this change enables that.
2018-12-10Don't require BLK nodes for SIMDCarol Eidt1-6/+9
Eliminate most cases where an OBJ or BLK node is required for SIMD values. The exception is the case where a value produced by an intrinsic (SIMD or HWIntrinsic) is used as an argument but the argument is of a different SIMD type (e.g. a different baseType),
2018-11-27Improve perf for Index based span indexers (#21196)Andy Ayers1-15/+96
First, evaluate the actual index before invoking the underlying int indexer, so that the jit doesn't think the span is address taken. Second, improve the jit's ability to remove some redundant comparisons like those that arise in computing the actual index.
2018-11-25Don't generate copy assertions for normalize on load variablesMike Danes1-0/+7
2018-09-20Updated assertionprop.cppBrian Sullivan1-31/+30
2018-09-19Changes to use VNNormalValue in assertionPropBrian Sullivan1-53/+61
2018-08-28Cast gtIconVal to target_ssize_t in src/jit/assertionprop.cppEgor Chesakov1-1/+3
2018-08-28Do not Constant-Prop immediate values that require relocation on ARM32Egor Chesakov1-0/+5
2018-08-25Remove some GT_ASG_op leftovers (#18205)mikedn1-2/+2
2018-08-25Streamline fgExcludeFromSsa (#15351)mikedn1-2/+2
This function is relatively expensive due to the many checks it does. Adding an LclVarDsc "in SSA" bit that is set during SSA construction by calling fgExcludeFromSsa only once per variable results in 0.35% drop in instructions retired. Most of the checks done in fgExcludeFromSsa are implied by lvTracked and they could probably be converted to asserts. But lvOverlappingFields is not implied by lvTracked so even if all redundant checks are converted to asserts fgExcludeFromSsa still needs 2 checks rather than just one. Incidentally, this difference between tracked variables and SSA variables results in SSA and value numbers being assigned to some variables that are actually excluded from SSA - SsaBuilder::RenameVariables and fgValueNumber assign numbers to all live in fgFirstBB variables that require initialization without checking fgExcludeFromSsa first. Structs with overlapping fields are not common but properly excluding them is still enough to save 0.15% memory when compiling corelib. - Replace calls to fgExcludeFromSsa with calls to lvaInSsa (the old name is kind of weird, it has nothing to do with the flow graph and "exclude" results in double negation) - Move fgExcludeFromSsa logic to SsaBuild::IncludeInSsa and use it to initialize LclVarDsc::lvInSsa for all variables - Change RenameVariables and fgValueNumber to call lvaInSsa before assigning numbers to live in fgFirstBB variables
2018-08-23Merge branch 'master' into fmt-bbBrian Sullivan1-2/+2
2018-08-23Merge pull request #15011 from mikedn/ssa-mem-numCarol Eidt1-2/+2
Eliminate duplicate SSA number bookkeeping
2018-08-22define FMT_BB as "BB%02u" and use it uniformly in the codebaseBrian Sullivan1-31/+32
We use the following format when print the BasicBlock number: bbNum This define is used with string concatenation to put this in printf format strings
2018-08-21Define FMT_VN as "$%x" and use it uniformly in the codebaseBrian Sullivan1-1/+1
We use a unique prefix character when printing value numbers in dumps: i.e. $1c0 This define is used with string concatenation to put this in printf format strings
2018-08-20JIT: remove incremental ref count updates (#19345)Andy Ayers1-41/+2
Remove almost all of the code in the jit that tries to maintain local ref counts incrementally. Also remove `lvaSortAgain` and related machinery. Explicitly sort locals before post-lower-liveness when optimizing to get the best set of tracked locals. Explicitly recount after post-lower liveness to get accurate counts after dead stores. This can lead to tracked unreferenced arguments; tolerate this during codegen.
2018-07-23Change gtExtractSideEffList to use GenTreeVisitor (#18257)mikedn1-5/+27
* Change gtExtractSideEffList to use GenTreeVisitor The tree traversal logic in gtExtractSideEffList is basically an incomplete duplicate of GenTreeVisitor's traversal logic. It lacks handling for GT_ARR_ELEM and GT_ARR_OFFSET so if this are encountered any side effects their children may have are silently dropped. In addition, side effect ordering was not always preserved. The comma list is built by prepending nodes to it so side effects have to be visited in reverse execution order. The old code did this only for simple opers, for special nodes such as GT_ARR_BOUNDS_CHECK normal execution order was used. This actually complicates a bit the GenTreeVisitor implementation as side effects need to be first stored in an array. The number of side effects is usually small (<= 4) so this shouldn't be a problem. * Use GTF_SIDE_EFFECT in optPrepareTreeForReplacement Assertion propagation doesn't have any way to ensure that it is safe to remove class constructor calls so GTF_PERSISTENT_SIDE_EFFECTS_IN_CSE should not be used here. Likewise, GTF_EXCEPT side effects must be preserved as well. VN doesn't always propagate exceptions so it's possible to end up with a tree that has a constant VN and contains exception side effects. * Add tests for 18232 * CR feedback
2018-07-22JIT: stateful local ref counts and weights (#19068)Andy Ayers1-2/+2
Introduce a notion of state for local var ref counts and weighted ref counts. Accesses and current state must agree. State is invalid initially, enabled for an early period around bits of morph, invalid again for a time, and then enabled normally once lvaMarkRefs is called. Accesses normally specify RCS_NORMAL as the desired state, but in the accesses of selected ref counts in morph, specify RCS_EARLY. Revise how we decide if normal ref counting is active by changing `lvaLocalVarRefCounted` into a method. Update `gtIsLikelyRegVar` to not access ref counts when they're not in a valid state. Change weight APIs over to use `weight_t`.
2018-07-19Eliminate duplicate SSA number bookkeepingMike Danes1-2/+2
During SSA construction SsaRenameState keeps a definition count for each variable in an array. But each variable has a lvPerSsaData array that does almost the same thing, count the definitions. "Almost" because lvPerSsaData is a JitExpandArray that tracks only the array size and not the number of elements actually stored in the array. Replace JitExpandArray with purposely designed "array" that is in charge with allocating new SSA numbers and handles their intricacies - RESERVED_SSA_NUM, UNINIT_SSA_NUM and FIRST_SSA_NUM. This also allows the removal of the allocator from the array. Allocating new SSA numbers happens only during SSA construction and it's reasonable to pass the allocator to AllocSsaNum rather than increasing the size of PerSsaArray and LclVarDsc.
2018-07-18JIT: force all local var ref counts to be accessed via API (#18979)Andy Ayers1-2/+2
This is a preparatory change for auditing and controlling how local variable ref counts are observed and manipulated. See #18969 for context. No diffs seen locally. No TP impact expected. There is a small chance we may see some asserts in broader testing as there were places in original code where local ref counts were incremented without checking for possible overflows. The new APIs will assert for overflow cases.
2018-06-29Corrected a few typos in the documentation and comments (#18706)Phil Garcia1-1/+1
* Corrected a few typos in the documentation and comments * Corrected a few typos in the documentation and comments * Corrected a few typos in the documentation and comments * Corrected a few typos in the documentation and comments * Corrected a few typos in the documentation and comments * Corrected a few typos in the documentation and comments
2018-06-08Workaround for compiler.hpp (1848) - Assertion failed 'lvRefCnt' (#18292)Sergey Andreenko1-16/+22
* add test * clean fgRemoveStmt a bit * fix the issue (more like a workaround).
2018-05-22Remove JIT LEGACY_BACKEND code (#18064)Bruce Forstall1-3/+0
Remove JIT LEGACY_BACKEND code All code related to the LEGACY_BACKEND JIT is removed. This includes all code related to x87 floating-point code generation. Almost 50,000 lines of code have been removed. Remove legacyjit/legacynonjit directories Remove reg pairs Remove tiny instruction descriptors Remove compCanUseSSE2 (it's always true) Remove unused FEATURE_FP_REGALLOC
2018-01-31Delete GenTreePtr. (#16027)Sergey Andreenko1-109/+101
* jit sources: Each local pointer variable must be declared on its own line. Implement https://github.com/dotnet/coreclr/blob/master/Documentation/coding-guidelines/clr-jit-coding-conventions.md#101-pointer-declarations Each local pointer variable must be declared on its own line. * add constGenTreePtr * delete GenTreePtr * delete constGenTreePtr * fix arm
2017-12-13get rid of TYP_CHARFei Peng1-2/+0
2017-12-12Use macro _countof instead of explicit sizeof(arr) / sizeof(arr[0]) or ↵Egor Chesakov1-1/+1
sizeof(arr) / sizeof(*arr) in clrjit. (#15474)
2017-11-22Clean up `GTF_CALL_VIRT_KIND_MASK` and related usageBruce Forstall1-1/+1
Use the existing accessor functions instead of checking the bits directly.
2017-11-06Delete OldStyleClearD. (#14874)Sergey Andreenko1-1/+1
* Delete OldStyleClearD from flowgraph BlockSetOps::Assign requires sets to have the same size, there is no an additional risk to use ClearD then. * delete OldStyleClearD from regalloc regalloc doesn't create new local variables and doesn't change epoch. * Delete OldStyleClearD from copyprop CopyProp doesn't create new vars. Also `VarSetOps::Assign(this, compCurLife, block->bbLiveIn); ` before the loop requires epoch to be the same. * Delete OldStyleClearD from assertionpop Assertion prop doesn't change epoch. * Delete OldStyleClearD from the emmit Because it doesn't create new local vars. * Delete declarations
2017-11-06Merge pull request #14506 from mikedn/alloc-messBrian Sullivan1-2/+2
Streamline JIT memory allocation
2017-10-18Ifdef out legacy uses of GT_ASG_op (#14384)mikedn1-2/+4
* Ifdef out legacy uses of GT_ASG_op GT_ASG_op nodes are only generated when the legacy backend is used. * Address feedback * Cleanup gtOverflow/gtOverflowEx
2017-10-15Copy ExpandArray and SimplerHashTable to JIT's sourcesMike Danes1-2/+2
These need to be modified to work directly with JIT's allocator(s) instead of going through IAllocator. It may also be useful to adjust these to account for the fact that the JIT never releases memory. Besides, the JIT is the primary user of these classes - only ExpandArray(Stack) isn't used anywhere else and SimplerHashTable's only other user is the gcinfo library. Renamed headers and classes to avoid potential conflicts with the old ones. Also made the JIT's hash table behavior the default to avoid the need to specify it in hash table instantiations.
2017-08-31Enable checking of GTF_EXCEPT and GTF_ASG flags. (#13668)Eugene Rozenfeld1-1/+2
* Enable checking of GTF_EXCEPT and GTF_ASG flags. fgDebugCheckFlags is modified to check that GTF_EXCEPT and GTF_ASG are set precisely when needed. It's also modified to handle several special operators correctly. fgAddrCouldBeNull is updated to check for handles, implicit byref locals, and stack byrefs. OperMayThrow is modified to handle several operators correctly. GTF_IND_NONFAULTING is reused on operations for which OperIsIndir() is true and on GT_ARR_LENGTH. Various places in morph are updated to set side effect flags correctly. gtUpdateSideEffects is re-written so that it's precise for GTF_ASG and GTF_EXCEPT and conservatively correct for the other side effects. It's now called from more places to keep the flags up-to-date after transformations. NoThrow in HelperCallProperties is updated and GTF_EXCEPT flag is set on helper calls according to that property. optRemoveRangeCheck is cleaned up and simplified.
2017-08-07Removed the legacy JIT32 assert regarding 4-byte alignment ↵Brian Sullivan1-4/+8
inArenaAllocator::allocateMemory Immediately after this assert we roundUp to an pointer size allocation amount. Stopped using two implementation of ArenaAllocator::allocateMemory Instead we add ifdef DEBUG parts to the common version Move the implementation of ArenaAllocator::allocateMemory to the header file Fixed a couple of allocations in assertionprop to use CMF_AssertionProp so that we correctly attribute which phase uses the memory being allocated. Added range check for the array writes in Compiler::optMapComplementary Removed the AlignUp to 4-byte in operator new and new[] in compiler.hpp
2017-08-04Revert "Fixes issue #13093"Bruce Forstall1-8/+4
This reverts commit 0d390cceb7ab0c8a271afce315fe4456211fdc6c.