bool optNarrowTree (GenTreePtr tree,
var_types srct,
var_types dstt,
+ ValueNumPair vnpNarrow,
bool doit);
/**************************************************************************
return gtVNPair.SetConservative(vn);
}
}
+ void SetVNs(ValueNumPair vnp)
+ {
+ gtVNPair = vnp;
+ }
void ClearVN()
{
gtVNPair = ValueNumPair(); // Initializes both elements to "NoVN".
if (!tree->gtOverflow() &&
!gtIsActiveCSE_Candidate(oper) &&
(opts.compFlags & CLFLG_TREETRANS) &&
- optNarrowTree(oper, srcType, dstType, false))
+ optNarrowTree(oper, srcType, dstType, tree->gtVNPair, false))
{
- optNarrowTree(oper, srcType, dstType, true);
+ optNarrowTree(oper, srcType, dstType, tree->gtVNPair, true);
/* If oper is changed into a cast to TYP_INT, or to a GT_NOP, we may need to discard it */
if (oper->gtOper == GT_CAST && oper->CastToType() == genActualType(oper->CastFromType()))
bool Compiler::optNarrowTree(GenTreePtr tree,
var_types srct,
var_types dstt,
+ ValueNumPair vnpNarrow,
bool doit)
{
genTreeOps oper;
return false;
}
+ ValueNumPair NoVNPair = ValueNumPair();
+
if (kind & GTK_LEAF)
{
switch (oper)
// Is op2 a small constant than can be narrowed into dstt?
// if so the result of the GT_AND will also fit into 'dstt' and can be narrowed
- if ((op2->gtOper == GT_CNS_INT) && optNarrowTree(op2, srct, dstt, false))
+ if ((op2->gtOper == GT_CNS_INT) && optNarrowTree(op2, srct, dstt, NoVNPair, false))
{
// We will change the type of the tree and narrow op2
//
if (doit)
{
tree->gtType = genActualType(dstt);
- tree->ClearVN();
+ tree->SetVNs(vnpNarrow);
- optNarrowTree(op2, srct, dstt, true);
+ optNarrowTree(op2, srct, dstt, NoVNPair, true);
// We may also need to cast away the upper bits of op1
if (srcSize == 8)
{
if (gtIsActiveCSE_Candidate(op1) ||
gtIsActiveCSE_Candidate(op2) ||
- !optNarrowTree(op1, srct, dstt, doit) ||
- !optNarrowTree(op2, srct, dstt, doit) )
+ !optNarrowTree(op1, srct, dstt, NoVNPair, doit) ||
+ !optNarrowTree(op2, srct, dstt, NoVNPair, doit) )
{
noway_assert(doit == false);
return false;
tree->gtFlags &= ~GTF_MUL_64RSLT;
tree->gtType = genActualType(dstt);
- tree->ClearVN();
+ tree->SetVNs(vnpNarrow);
}
return true;
if (doit && (dstSize <= genTypeSize(tree->gtType)))
{
tree->gtType = genSignedType(dstt);
- tree->ClearVN();
+ tree->SetVNs(vnpNarrow);
/* Make sure we don't mess up the variable type */
if ((oper == GT_LCL_VAR) || (oper == GT_LCL_FLD))
// The result type of a GT_CAST is never a small type.
// Use genActualType to widen dstt when it is a small types.
tree->gtType = genActualType(dstt);
- tree->ClearVN();
+ tree->SetVNs(vnpNarrow);
}
}
case GT_COMMA:
if (!gtIsActiveCSE_Candidate(op2) &&
- optNarrowTree(op2, srct, dstt, doit))
+ optNarrowTree(op2, srct, dstt, vnpNarrow, doit))
{
/* Simply change the type of the tree */
if (doit)
{
tree->gtType = genActualType(dstt);
- tree->ClearVN();
+ tree->SetVNs(vnpNarrow);
}
return true;
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
\ No newline at end of file
--- /dev/null
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+.assembly extern legacy library mscorlib {}
+
+.assembly devdiv_180411
+{
+}
+.class _simple {
+
+.method static int32 main(class System.String[]) {
+.entrypoint
+.maxstack 100
+call int64 [devdiv_180411]_simple::test()
+conv.i4
+ldc.i4 100
+add
+ret
+}
+
+.method static int64 test() {
+.maxstack 100
+.locals init (int32 local_0x1)
+
+ldloc.s 0
+neg
+conv.ovf.u8
+conv.i4
+neg
+conv.u8
+ret
+}
+
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="devdiv_180411.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
\ No newline at end of file