Skip to content

Commit

Permalink
NativeAOT: Ignore preferSize and always expand TLS (dotnet#97187)
Browse files Browse the repository at this point in the history
* Always expand TLS for NativeAOT

* Update src/coreclr/jit/helperexpansion.cpp

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
  • Loading branch information
2 people authored and tmds committed Jan 23, 2024
1 parent a3c4c5d commit fd6103e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/coreclr/jit/helperexpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,15 @@ PhaseStatus Compiler::fgExpandThreadLocalAccess()
return result;
}

// Always expand for NativeAOT because the TLS access will not be generated by NativeAOT
// Always expand for NativeAOT because the slow TLS access helper will not be generated by NativeAOT
const bool isNativeAOT = IsTargetAbi(CORINFO_NATIVEAOT_ABI);
if (!isNativeAOT && opts.OptimizationDisabled())
if (isNativeAOT)
{
return fgExpandHelper<&Compiler::fgExpandThreadLocalAccessForCallNativeAOT>(
false /* expand rarely run blocks for NativeAOT */);
}

if (opts.OptimizationDisabled())
{
JITDUMP("Optimizations aren't allowed - bail out.\n")
return result;
Expand All @@ -459,9 +465,7 @@ PhaseStatus Compiler::fgExpandThreadLocalAccess()
return result;
}

return isNativeAOT ? fgExpandHelper<&Compiler::fgExpandThreadLocalAccessForCallNativeAOT>(
false /* expand rarely run blocks for NativeAOT */)
: fgExpandHelper<&Compiler::fgExpandThreadLocalAccessForCall>(true);
return fgExpandHelper<&Compiler::fgExpandThreadLocalAccessForCall>(true);
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit fd6103e

Please sign in to comment.