Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: simple forward substitution pass #63720

Merged
merged 30 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
86992b6
JIT: simple forward substitution pass
AndyAyersMS Jan 7, 2022
28cdc5e
Fix windows x86 and arm64 issues:
AndyAyersMS Jan 13, 2022
721938e
reorder checks
AndyAyersMS Jan 13, 2022
6e4a5ad
longs on x86 are special
AndyAyersMS Jan 13, 2022
f4599a9
fix arm; don't forward sub no return calls
AndyAyersMS Jan 14, 2022
81e9ec2
add extra check for address exposed uses
AndyAyersMS Jan 14, 2022
70195af
add extra globals check, add disable switch
AndyAyersMS Jan 14, 2022
0c4ec67
properly count implicit promoted field uses
AndyAyersMS Jan 20, 2022
2e6bd0b
look for exposed uses in target statement too
AndyAyersMS Jan 21, 2022
3d24ab1
Merge branch 'main' into SimpleForwardSubstitution
AndyAyersMS Jan 21, 2022
ae37a96
fix bad merge
AndyAyersMS Jan 21, 2022
cd92c72
update debuginfo test
AndyAyersMS Jan 21, 2022
7b06887
be more cautious about struct fwd sub
AndyAyersMS Jan 22, 2022
f415fe5
avoid if initial assign has mismatched type
AndyAyersMS Jan 23, 2022
727037e
complexity limit; move tree to sub checks earlier
AndyAyersMS Jan 24, 2022
6003ea9
fix crossgen2 simd issue
AndyAyersMS Jan 24, 2022
52ca482
make sure we don't lose multireg uses
AndyAyersMS Jan 24, 2022
44ac7d1
avoid call under call sub for now
AndyAyersMS Jan 25, 2022
7abf2fb
size limit for next stmt too
AndyAyersMS Jan 26, 2022
985bb7b
JIT: fix x86 codegen issue
AndyAyersMS Jan 28, 2022
d3dfc24
review feedback
AndyAyersMS Jan 29, 2022
cb6786c
Merge branch 'main' into SimpleForwardSubstitution
AndyAyersMS Jan 29, 2022
79d2255
Apply suggestions from code review
AndyAyersMS Jan 29, 2022
b3d52fe
fix issue with subbing past normalize on store assignment
AndyAyersMS Jan 30, 2022
f1509ce
clean up nullcheck of new helper
AndyAyersMS Feb 1, 2022
6cb1c9c
fix build break
AndyAyersMS Feb 1, 2022
a9599d3
revise check in gtFoldExprCompare to avoid a few regressions
AndyAyersMS Feb 1, 2022
ba9a444
refine gtFoldExprCompare
AndyAyersMS Feb 1, 2022
a41602c
Merge branch 'main' into SimpleForwardSubstitution
AndyAyersMS Feb 2, 2022
44aa580
add more thorough checking for call arg interference
AndyAyersMS Feb 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ set( JIT_SOURCES
fgprofile.cpp
fgstmt.cpp
flowgraph.cpp
forwardsub.cpp
gcdecode.cpp
gcencode.cpp
gcinfo.cpp
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4796,6 +4796,13 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_STR_ADRLCL, &Compiler::fgMarkAddressExposedLocals);

// Run a simple forward sub pass.
AndyAyersMS marked this conversation as resolved.
Show resolved Hide resolved
//
if (opts.OptimizationEnabled())
AndyAyersMS marked this conversation as resolved.
Show resolved Hide resolved
{
DoPhase(this, PHASE_FWD_SUB, &Compiler::fgForwardSub);
}

// Apply the type update to implicit byref parameters; also choose (based on address-exposed
// analysis) which implicit byref promotions to keep (requires copy to initialize) or discard.
//
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6411,7 +6411,7 @@ class Compiler

bool fgMorphCanUseLclFldForCopy(unsigned lclNum1, unsigned lclNum2);

GenTreeLclVar* fgMorphTryFoldObjAsLclVar(GenTreeObj* obj);
GenTreeLclVar* fgMorphTryFoldObjAsLclVar(GenTreeObj* obj, bool destroyNodes = true);
GenTree* fgMorphCommutative(GenTreeOp* tree);
GenTree* fgMorphCastedBitwiseOp(GenTreeOp* tree);

Expand Down Expand Up @@ -6550,6 +6550,10 @@ class Compiler
void fgMarkAddressExposedLocals();
void fgMarkAddressExposedLocals(Statement* stmt);

PhaseStatus fgForwardSub();
bool fgForwardSub(BasicBlock* block);
bool fgForwardSub(Statement* statement);
AndyAyersMS marked this conversation as resolved.
Show resolved Hide resolved

static fgWalkPreFn fgUpdateSideEffectsPre;
static fgWalkPostFn fgUpdateSideEffectsPost;

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/compphases.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CompPhaseNameMacro(PHASE_UPDATE_FINALLY_FLAGS, "Update finally target flags",
CompPhaseNameMacro(PHASE_COMPUTE_PREDS, "Compute preds", "PREDS", false, -1, false)
CompPhaseNameMacro(PHASE_EARLY_UPDATE_FLOW_GRAPH,"Update flow graph early pass", "UPD-FG-E", false, -1, false)
CompPhaseNameMacro(PHASE_STR_ADRLCL, "Morph - Structs/AddrExp", "MOR-STRAL",false, -1, false)
CompPhaseNameMacro(PHASE_FWD_SUB, "Forward Sub", "FWD-SUB", false, -1, false)
AndyAyersMS marked this conversation as resolved.
Show resolved Hide resolved
CompPhaseNameMacro(PHASE_MORPH_IMPBYREF, "Morph - ByRefs", "MOR-BYREF",false, -1, false)
CompPhaseNameMacro(PHASE_PROMOTE_STRUCTS, "Morph - Promote Structs", "PROMOTER" ,false, -1, false)
CompPhaseNameMacro(PHASE_MORPH_GLOBAL, "Morph - Global", "MOR-GLOB", false, -1, false)
Expand Down
Loading