Skip to content

Commit

Permalink
JIT: Move VN-based intrinsic expansion later (#106750)
Browse files Browse the repository at this point in the history
This avoids making CFG changes before IV opts, which relies on many
flowgraph related annotations. For example, this expansion will create
new basic blocks with empty liveness sets that IV opts potentially could
end up querying.
  • Loading branch information
jakobbotsch authored Aug 23, 2024
1 parent f677348 commit 269ea26
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5057,10 +5057,10 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
doBranchOpt = doValueNum && (JitConfig.JitDoRedundantBranchOpts() != 0);
doCse = doValueNum;
doAssertionProp = doValueNum && (JitConfig.JitDoAssertionProp() != 0);
doVNBasedIntrinExpansion = doValueNum;
doRangeAnalysis = doAssertionProp && (JitConfig.JitDoRangeAnalysis() != 0);
doOptimizeIVs = doAssertionProp && (JitConfig.JitDoOptimizeIVs() != 0);
doVNBasedDeadStoreRemoval = doValueNum && (JitConfig.JitDoVNBasedDeadStoreRemoval() != 0);
doVNBasedIntrinExpansion = doValueNum;
#endif // defined(OPT_CONFIG)

if (opts.optRepeat)
Expand Down Expand Up @@ -5147,13 +5147,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_ASSERTION_PROP_MAIN, &Compiler::optAssertionPropMain);
}

if (doVNBasedIntrinExpansion)
{
// Expand some intrinsics based on VN data
//
DoPhase(this, PHASE_VN_BASED_INTRINSIC_EXPAND, &Compiler::fgVNBasedIntrinsicExpansion);
}

if (doRangeAnalysis)
{
// Bounds check elimination via range analysis
Expand All @@ -5175,6 +5168,13 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_VN_BASED_DEAD_STORE_REMOVAL, &Compiler::optVNBasedDeadStoreRemoval);
}

if (doVNBasedIntrinExpansion)
{
// Expand some intrinsics based on VN data
//
DoPhase(this, PHASE_VN_BASED_INTRINSIC_EXPAND, &Compiler::fgVNBasedIntrinsicExpansion);
}

// Conservatively mark all VNs as stale
vnStore = nullptr;

Expand Down

0 comments on commit 269ea26

Please sign in to comment.