GenTreeLclVar* varStrLcl = gtNewLclvNode(varStrTmp, varStr->TypeGet());
// Create a tree representing string's Length:
- // TODO-Unroll-CQ: Consider using ARR_LENGTH here, but we'll have to modify QMARK to propagate BBF_HAS_IDX_LEN
int strLenOffset = OFFSETOF__CORINFO_String__stringLen;
- GenTree* lenOffset = gtNewIconNode(strLenOffset, TYP_I_IMPL);
- GenTree* lenNode = gtNewIndir(TYP_INT, gtNewOperNode(GT_ADD, TYP_BYREF, varStrLcl, lenOffset));
+ GenTree* lenNode = gtNewArrLen(TYP_INT, varStrLcl, strLenOffset, compCurBB);
varStrLcl = gtClone(varStrLcl)->AsLclVar();
GenTree* unrolled = impExpandHalfConstEquals(varStrLcl, lenNode, needsNullcheck, startsWith, (WCHAR*)str, cnsLength,
// if they are going to be cleared by fgSplitBlockAfterStatement(). We currently only do this only
// for the GC safe point bit, the logic being that if 'block' was marked gcsafe, then surely
// remainderBlock will still be GC safe.
- BasicBlockFlags propagateFlags = block->bbFlags & BBF_GC_SAFE_POINT;
- BasicBlock* remainderBlock = fgSplitBlockAfterStatement(block, stmt);
+ BasicBlockFlags propagateFlagsToRemainder = block->bbFlags & BBF_GC_SAFE_POINT;
+ // Conservatively propagate BBF_COPY_PROPAGATE flags to all blocks
+ BasicBlockFlags propagateFlagsToAll = block->bbFlags & BBF_COPY_PROPAGATE;
+ BasicBlock* remainderBlock = fgSplitBlockAfterStatement(block, stmt);
fgRemoveRefPred(remainderBlock, block); // We're going to put more blocks between block and remainderBlock.
BasicBlock* condBlock = fgNewBBafter(BBJ_COND, block, true);
elseBlock->bbFlags |= BBF_IMPORTED;
}
- remainderBlock->bbFlags |= propagateFlags;
+ remainderBlock->bbFlags |= (propagateFlagsToRemainder | propagateFlagsToAll);
condBlock->inheritWeight(block);
fgAddRefPred(elseBlock, condBlock);
fgAddRefPred(remainderBlock, elseBlock);
+ condBlock->bbFlags |= propagateFlagsToAll;
+ elseBlock->bbFlags |= propagateFlagsToAll;
+
BasicBlock* thenBlock = nullptr;
if (hasTrueExpr && hasFalseExpr)
{
thenBlock = fgNewBBafter(BBJ_ALWAYS, condBlock, true);
thenBlock->bbJumpDest = remainderBlock;
+ thenBlock->bbFlags |= propagateFlagsToAll;
if ((block->bbFlags & BBF_INTERNAL) == 0)
{
thenBlock->bbFlags &= ~BBF_INTERNAL;
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
/// Indicates whether the current application is running on the specified platform.
/// </summary>
/// <param name="platform">Case-insensitive platform name. Examples: Browser, Linux, FreeBSD, Android, iOS, macOS, tvOS, watchOS, Windows.</param>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsOSPlatform(string platform)
{
ArgumentNullException.ThrowIfNull(platform);