}
}
-//------------------------------------------------------------------------
-// getNonEmptyBlock: Return the first non-empty block starting with 'block'
-//
-// Arguments:
-// block - the BasicBlock from which we start looking
-//
-// Return Value:
-// The first non-empty BasicBlock we find.
-//
-BasicBlock* getNonEmptyBlock(BasicBlock* block)
-{
- while (block != nullptr && block->GetFirstLIRNode() == nullptr)
- {
- block = block->GetUniqueSucc();
- }
- assert(block != nullptr && block->GetFirstLIRNode() != nullptr);
- return block;
-}
-
//------------------------------------------------------------------------
// insertZeroInitRefPositions: Handle lclVars that are live-in to the first block
//
}
JITDUMP(" creating ZeroInit\n");
- GenTree* firstNode = getNonEmptyBlock(compiler->fgFirstBB)->firstNode();
- RefPosition* pos =
- newRefPosition(interval, MinLocation, RefTypeZeroInit, firstNode, allRegs(interval->registerType));
+ RefPosition* pos = newRefPosition(interval, MinLocation, RefTypeZeroInit, nullptr /* theTreeNode */,
+ allRegs(interval->registerType));
pos->setRegOptional(true);
}
else
if (interval->recentRefPosition == nullptr)
{
JITDUMP(" creating ZeroInit\n");
- GenTree* firstNode = getNonEmptyBlock(compiler->fgFirstBB)->firstNode();
- RefPosition* pos = newRefPosition(interval, MinLocation, RefTypeZeroInit, firstNode,
- allRegs(interval->registerType));
+ RefPosition* pos = newRefPosition(interval, MinLocation, RefTypeZeroInit,
+ nullptr /* theTreeNode */, allRegs(interval->registerType));
pos->setRegOptional(true);
varDsc->lvMustInit = true;
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.CompilerServices;
+
+public class Runtime_54100
+{
+ // The test ends up containing an empty try block and we do not find a
+ // non-empty block from which a treeNode can be extracted to use it for
+ // creating zero-init refPositions.
+
+ static ushort[][] s_23 = new ushort[][]{new ushort[]{0}};
+ static short s_32;
+ static short s_33;
+ static int s_45;
+ public static int Main()
+ {
+ ushort[] vr4 = s_23[0];
+ return (int)M45();
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static ushort M45()
+ {
+ short var0;
+ try
+ {
+ var0 = s_32;
+ }
+ finally
+ {
+ var0 = s_33;
+ int var1 = s_45;
+ ulong vr8 = default(ulong);
+ var0 = (short)((sbyte)vr8 - var0);
+ try
+ {
+ M46();
+ }
+ finally
+ {
+ M46();
+ }
+
+ System.Console.WriteLine(var1);
+ }
+
+ return 100;
+ }
+
+ static ulong M46()
+ {
+ return default(ulong);
+ }
+}