Browse Source

Allow splitting a variable even if it has its address taken and stored in a ref-local.

The currently implementation is somewhat minimal and only works in a very limited set of circumstances:
 * the ref local is single-assignment
 * the ref local is initialized directly with 'ldloca target; stloc ref_local',
     not a derived pointer (e.g. 'ldloca target; ldflda F; stloc ref_local').
 * all uses of the ref_local are immediately consuming the address

This improves variable splitting cases where the compiler re-uses a stack slot containing a reference,
e.g. in some cases of '?.' on Nullable<T>.
pull/1213/head
Daniel Grunwald 7 years ago
parent
commit
7ee686cb67
  1. 6
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs
  2. 501
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.opt.roslyn.il
  3. 503
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.roslyn.il
  4. 12
      ICSharpCode.Decompiler/IL/ILVariable.cs
  5. 87
      ICSharpCode.Decompiler/IL/Transforms/SplitVariables.cs

6
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs

@ -127,7 +127,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -127,7 +127,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public void CallDoneStruct()
{
GetMyStruct()?.Done();
#if STRUCT_SPLITTING_IMPROVED
GetMyStruct()?.Field?.Done();
GetMyStruct()?.Field.Done();
GetMyStruct()?.Property1?.Done();
@ -135,16 +134,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -135,16 +134,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
GetMyStruct()?.Method1(GetInt())?.Done();
GetMyStruct()?.Method2(GetInt()).Done();
GetMyStruct()?[GetInt()]?.Done();
#endif
}
public void RequiredParentheses()
{
(GetMyClass()?.Field).Done();
(GetMyClass()?.Method(GetInt())).Done();
#if STRUCT_SPLITTING_IMPROVED
(GetMyStruct()?.Property2)?.Done();
#endif
}
public int?[] ChainsOnClass()
@ -162,7 +158,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -162,7 +158,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
};
}
#if STRUCT_SPLITTING_IMPROVED
public int?[] ChainsStruct()
{
return new int?[8] {
@ -176,7 +171,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -176,7 +171,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
GetMyStruct()?[GetInt()]?.IntVal
};
}
#endif
public int CoalescingReturn()
{

501
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.opt.roslyn.il

@ -238,7 +238,7 @@ @@ -238,7 +238,7 @@
} // end of class ITest
.class abstract auto ansi sealed nested private beforefieldinit '<>o__26'
.class abstract auto ansi sealed nested private beforefieldinit '<>o__27'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
@ -246,7 +246,7 @@ @@ -246,7 +246,7 @@
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> '<>p__1'
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> '<>p__2'
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> '<>p__3'
} // end of class '<>o__26'
} // end of class '<>o__27'
.method private hidebysig instance int32
GetInt() cil managed
@ -467,33 +467,197 @@ @@ -467,33 +467,197 @@
.method public hidebysig instance void
CallDoneStruct() cil managed
{
// Code size 33 (0x21)
// Code size 388 (0x184)
.maxstack 2
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_1)
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_1,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_2)
IL_0000: ldarg.0
IL_0001: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0006: stloc.0
IL_0007: ldloca.s V_0
IL_0009: dup
IL_000a: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_000f: brtrue.s IL_0013
IL_000f: brtrue.s IL_0014
IL_0011: pop
IL_0012: ret
IL_0012: br.s IL_0021
IL_0014: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0019: stloc.1
IL_001a: ldloca.s V_1
IL_001c: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0021: ldarg.0
IL_0022: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0027: stloc.0
IL_0028: ldloca.s V_0
IL_002a: dup
IL_002b: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0030: brtrue.s IL_0035
IL_0032: pop
IL_0033: br.s IL_004a
IL_0035: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_003a: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_003f: dup
IL_0040: brtrue.s IL_0045
IL_0042: pop
IL_0043: br.s IL_004a
IL_0045: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_004a: ldarg.0
IL_004b: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0050: stloc.0
IL_0051: ldloca.s V_0
IL_0053: dup
IL_0054: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0059: brtrue.s IL_005e
IL_005b: pop
IL_005c: br.s IL_006d
IL_005e: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0063: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_0068: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_006d: ldarg.0
IL_006e: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0073: stloc.0
IL_0074: ldloca.s V_0
IL_0076: dup
IL_0077: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_007c: brtrue.s IL_0081
IL_0013: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0018: stloc.1
IL_0019: ldloca.s V_1
IL_001b: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0020: ret
IL_007e: pop
IL_007f: br.s IL_00a9
IL_0081: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0086: stloc.1
IL_0087: ldloca.s V_1
IL_0089: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property1()
IL_008e: stloc.2
IL_008f: ldloca.s V_2
IL_0091: dup
IL_0092: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0097: brtrue.s IL_009c
IL_0099: pop
IL_009a: br.s IL_00a9
IL_009c: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00a1: stloc.1
IL_00a2: ldloca.s V_1
IL_00a4: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_00a9: ldarg.0
IL_00aa: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00af: stloc.0
IL_00b0: ldloca.s V_0
IL_00b2: dup
IL_00b3: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00b8: brtrue.s IL_00bd
IL_00ba: pop
IL_00bb: br.s IL_00d2
IL_00bd: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00c2: stloc.1
IL_00c3: ldloca.s V_1
IL_00c5: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_00ca: stloc.1
IL_00cb: ldloca.s V_1
IL_00cd: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_00d2: ldarg.0
IL_00d3: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00d8: stloc.0
IL_00d9: ldloca.s V_0
IL_00db: dup
IL_00dc: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00e1: brtrue.s IL_00e6
IL_00e3: pop
IL_00e4: br.s IL_0114
IL_00e6: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00eb: stloc.1
IL_00ec: ldloca.s V_1
IL_00ee: ldarg.0
IL_00ef: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_00f4: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method1(int32)
IL_00f9: stloc.2
IL_00fa: ldloca.s V_2
IL_00fc: dup
IL_00fd: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0102: brtrue.s IL_0107
IL_0104: pop
IL_0105: br.s IL_0114
IL_0107: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_010c: stloc.1
IL_010d: ldloca.s V_1
IL_010f: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0114: ldarg.0
IL_0115: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_011a: stloc.0
IL_011b: ldloca.s V_0
IL_011d: dup
IL_011e: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0123: brtrue.s IL_0128
IL_0125: pop
IL_0126: br.s IL_0143
IL_0128: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_012d: stloc.1
IL_012e: ldloca.s V_1
IL_0130: ldarg.0
IL_0131: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0136: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method2(int32)
IL_013b: stloc.1
IL_013c: ldloca.s V_1
IL_013e: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0143: ldarg.0
IL_0144: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0149: stloc.0
IL_014a: ldloca.s V_0
IL_014c: dup
IL_014d: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0152: brtrue.s IL_0156
IL_0154: pop
IL_0155: ret
IL_0156: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_015b: stloc.1
IL_015c: ldloca.s V_1
IL_015e: ldarg.0
IL_015f: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0164: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Item(int32)
IL_0169: stloc.2
IL_016a: ldloca.s V_2
IL_016c: dup
IL_016d: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0172: brtrue.s IL_0176
IL_0174: pop
IL_0175: ret
IL_0176: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_017b: stloc.1
IL_017c: ldloca.s V_1
IL_017e: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0183: ret
} // end of method NullPropagation::CallDoneStruct
.method public hidebysig instance void
RequiredParentheses() cil managed
{
// Code size 53 (0x35)
.maxstack 8
// Code size 126 (0x7e)
.maxstack 2
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_2)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyClass()
IL_0006: dup
@ -518,7 +682,39 @@ @@ -518,7 +682,39 @@
IL_0025: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_002a: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Method(int32)
IL_002f: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_0034: ret
IL_0034: ldarg.0
IL_0035: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_003a: stloc.0
IL_003b: ldloca.s V_0
IL_003d: dup
IL_003e: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0043: brtrue.s IL_0051
IL_0045: pop
IL_0046: ldloca.s V_1
IL_0048: initobj valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>
IL_004e: ldloc.1
IL_004f: br.s IL_0063
IL_0051: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0056: stloc.2
IL_0057: ldloca.s V_2
IL_0059: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_005e: newobj instance void valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::.ctor(!0)
IL_0063: stloc.0
IL_0064: ldloca.s V_0
IL_0066: dup
IL_0067: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_006c: brtrue.s IL_0070
IL_006e: pop
IL_006f: ret
IL_0070: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0075: stloc.2
IL_0076: ldloca.s V_2
IL_0078: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_007d: ret
} // end of method NullPropagation::RequiredParentheses
.method public hidebysig instance valuetype [mscorlib]System.Nullable`1<int32>[]
@ -728,6 +924,251 @@ @@ -728,6 +924,251 @@
IL_01d9: ret
} // end of method NullPropagation::ChainsOnClass
.method public hidebysig instance valuetype [mscorlib]System.Nullable`1<int32>[]
ChainsStruct() cil managed
{
// Code size 582 (0x246)
.maxstack 5
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype [mscorlib]System.Nullable`1<int32> V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_2,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_3)
IL_0000: ldc.i4.8
IL_0001: newarr valuetype [mscorlib]System.Nullable`1<int32>
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: ldarg.0
IL_0009: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_000e: stloc.0
IL_000f: ldloca.s V_0
IL_0011: dup
IL_0012: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0017: brtrue.s IL_0025
IL_0019: pop
IL_001a: ldloca.s V_1
IL_001c: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0022: ldloc.1
IL_0023: br.s IL_0034
IL_0025: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_002a: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_002f: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0034: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_0039: dup
IL_003a: ldc.i4.1
IL_003b: ldarg.0
IL_003c: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0041: stloc.0
IL_0042: ldloca.s V_0
IL_0044: dup
IL_0045: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_004a: brtrue.s IL_0058
IL_004c: pop
IL_004d: ldloca.s V_1
IL_004f: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0055: ldloc.1
IL_0056: br.s IL_006c
IL_0058: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_005d: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_0062: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::IntVal
IL_0067: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_006c: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_0071: dup
IL_0072: ldc.i4.2
IL_0073: ldarg.0
IL_0074: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0079: stloc.0
IL_007a: ldloca.s V_0
IL_007c: dup
IL_007d: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0082: brtrue.s IL_0090
IL_0084: pop
IL_0085: ldloca.s V_1
IL_0087: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_008d: ldloc.1
IL_008e: br.s IL_00b3
IL_0090: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0095: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_009a: dup
IL_009b: brtrue.s IL_00a9
IL_009d: pop
IL_009e: ldloca.s V_1
IL_00a0: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_00a6: ldloc.1
IL_00a7: br.s IL_00b3
IL_00a9: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::IntVal
IL_00ae: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_00b3: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_00b8: dup
IL_00b9: ldc.i4.3
IL_00ba: ldarg.0
IL_00bb: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00c0: stloc.0
IL_00c1: ldloca.s V_0
IL_00c3: dup
IL_00c4: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00c9: brtrue.s IL_00d7
IL_00cb: pop
IL_00cc: ldloca.s V_1
IL_00ce: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_00d4: ldloc.1
IL_00d5: br.s IL_00ee
IL_00d7: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00dc: stloc.2
IL_00dd: ldloca.s V_2
IL_00df: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_00e4: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_00e9: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_00ee: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_00f3: dup
IL_00f4: ldc.i4.4
IL_00f5: ldarg.0
IL_00f6: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00fb: stloc.0
IL_00fc: ldloca.s V_0
IL_00fe: dup
IL_00ff: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0104: brtrue.s IL_0112
IL_0106: pop
IL_0107: ldloca.s V_1
IL_0109: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_010f: ldloc.1
IL_0110: br.s IL_0145
IL_0112: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0117: stloc.2
IL_0118: ldloca.s V_2
IL_011a: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property1()
IL_011f: stloc.3
IL_0120: ldloca.s V_3
IL_0122: dup
IL_0123: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0128: brtrue.s IL_0136
IL_012a: pop
IL_012b: ldloca.s V_1
IL_012d: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0133: ldloc.1
IL_0134: br.s IL_0145
IL_0136: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_013b: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_0140: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0145: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_014a: dup
IL_014b: ldc.i4.5
IL_014c: ldarg.0
IL_014d: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0152: stloc.0
IL_0153: ldloca.s V_0
IL_0155: dup
IL_0156: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_015b: brtrue.s IL_0169
IL_015d: pop
IL_015e: ldloca.s V_1
IL_0160: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0166: ldloc.1
IL_0167: br.s IL_0186
IL_0169: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_016e: stloc.2
IL_016f: ldloca.s V_2
IL_0171: ldarg.0
IL_0172: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0177: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method2(int32)
IL_017c: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_0181: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0186: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_018b: dup
IL_018c: ldc.i4.6
IL_018d: ldarg.0
IL_018e: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0193: stloc.0
IL_0194: ldloca.s V_0
IL_0196: dup
IL_0197: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_019c: brtrue.s IL_01aa
IL_019e: pop
IL_019f: ldloca.s V_1
IL_01a1: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_01a7: ldloc.1
IL_01a8: br.s IL_01e3
IL_01aa: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_01af: stloc.2
IL_01b0: ldloca.s V_2
IL_01b2: ldarg.0
IL_01b3: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_01b8: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method1(int32)
IL_01bd: stloc.3
IL_01be: ldloca.s V_3
IL_01c0: dup
IL_01c1: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_01c6: brtrue.s IL_01d4
IL_01c8: pop
IL_01c9: ldloca.s V_1
IL_01cb: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_01d1: ldloc.1
IL_01d2: br.s IL_01e3
IL_01d4: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_01d9: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_01de: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_01e3: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_01e8: dup
IL_01e9: ldc.i4.7
IL_01ea: ldarg.0
IL_01eb: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_01f0: stloc.0
IL_01f1: ldloca.s V_0
IL_01f3: dup
IL_01f4: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_01f9: brtrue.s IL_0207
IL_01fb: pop
IL_01fc: ldloca.s V_1
IL_01fe: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0204: ldloc.1
IL_0205: br.s IL_0240
IL_0207: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_020c: stloc.2
IL_020d: ldloca.s V_2
IL_020f: ldarg.0
IL_0210: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0215: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Item(int32)
IL_021a: stloc.3
IL_021b: ldloca.s V_3
IL_021d: dup
IL_021e: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0223: brtrue.s IL_0231
IL_0225: pop
IL_0226: ldloca.s V_1
IL_0228: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_022e: ldloc.1
IL_022f: br.s IL_0240
IL_0231: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0236: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_023b: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0240: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_0245: ret
} // end of method NullPropagation::ChainsStruct
.method public hidebysig instance int32
CoalescingReturn() cil managed
{
@ -1015,7 +1456,7 @@ @@ -1015,7 +1456,7 @@
IL_0005: ldnull
IL_0006: ret
IL_0007: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_0007: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_000c: brtrue.s IL_0048
IL_000e: ldc.i4.0
@ -1045,11 +1486,11 @@ @@ -1045,11 +1486,11 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_003e: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_0043: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_0048: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_0043: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_0048: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_004d: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Target
IL_0052: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_0057: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0052: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_0057: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_005c: brtrue.s IL_008d
IL_005e: ldc.i4.0
@ -1070,10 +1511,10 @@ @@ -1070,10 +1511,10 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_0083: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_0088: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_008d: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0088: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_008d: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_0092: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Target
IL_0097: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0097: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_009c: ldloc.0
IL_009d: callvirt instance !2 class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>::Invoke(!0,
!1)
@ -1088,7 +1529,7 @@ @@ -1088,7 +1529,7 @@
IL_00ac: ldnull
IL_00ad: ret
IL_00ae: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00ae: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00b3: brtrue.s IL_00e9
IL_00b5: ldc.i4.0
@ -1114,11 +1555,11 @@ @@ -1114,11 +1555,11 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_00df: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_00e4: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00e9: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00e4: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00e9: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00ee: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Target
IL_00f3: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00f8: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_00f3: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00f8: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_00fd: brtrue.s IL_012f
IL_00ff: ldc.i4.s 64
@ -1139,10 +1580,10 @@ @@ -1139,10 +1580,10 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_0125: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_012a: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_012f: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_012a: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_012f: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_0134: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Target
IL_0139: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_0139: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_013e: ldloc.1
IL_013f: callvirt instance !2 class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>::Invoke(!0,
!1)

503
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.roslyn.il

@ -272,7 +272,7 @@ @@ -272,7 +272,7 @@
} // end of class ITest
.class abstract auto ansi sealed nested private beforefieldinit '<>o__26'
.class abstract auto ansi sealed nested private beforefieldinit '<>o__27'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
@ -280,7 +280,7 @@ @@ -280,7 +280,7 @@
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> '<>p__1'
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> '<>p__2'
.field public static class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> '<>p__3'
} // end of class '<>o__26'
} // end of class '<>o__27'
.method private hidebysig instance int32
GetInt() cil managed
@ -543,10 +543,11 @@ @@ -543,10 +543,11 @@
.method public hidebysig instance void
CallDoneStruct() cil managed
{
// Code size 36 (0x24)
// Code size 399 (0x18f)
.maxstack 2
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_1)
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_1,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_2)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
@ -564,14 +565,184 @@ @@ -564,14 +565,184 @@
IL_001b: ldloca.s V_1
IL_001d: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0022: nop
IL_0023: ret
IL_0023: ldarg.0
IL_0024: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0029: stloc.0
IL_002a: ldloca.s V_0
IL_002c: dup
IL_002d: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0032: brtrue.s IL_0037
IL_0034: pop
IL_0035: br.s IL_004d
IL_0037: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_003c: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_0041: dup
IL_0042: brtrue.s IL_0047
IL_0044: pop
IL_0045: br.s IL_004d
IL_0047: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_004c: nop
IL_004d: ldarg.0
IL_004e: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0053: stloc.0
IL_0054: ldloca.s V_0
IL_0056: dup
IL_0057: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_005c: brtrue.s IL_0061
IL_005e: pop
IL_005f: br.s IL_0071
IL_0061: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0066: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_006b: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_0070: nop
IL_0071: ldarg.0
IL_0072: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0077: stloc.0
IL_0078: ldloca.s V_0
IL_007a: dup
IL_007b: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0080: brtrue.s IL_0085
IL_0082: pop
IL_0083: br.s IL_00ae
IL_0085: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_008a: stloc.1
IL_008b: ldloca.s V_1
IL_008d: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property1()
IL_0092: stloc.2
IL_0093: ldloca.s V_2
IL_0095: dup
IL_0096: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_009b: brtrue.s IL_00a0
IL_009d: pop
IL_009e: br.s IL_00ae
IL_00a0: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00a5: stloc.1
IL_00a6: ldloca.s V_1
IL_00a8: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_00ad: nop
IL_00ae: ldarg.0
IL_00af: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00b4: stloc.0
IL_00b5: ldloca.s V_0
IL_00b7: dup
IL_00b8: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00bd: brtrue.s IL_00c2
IL_00bf: pop
IL_00c0: br.s IL_00d8
IL_00c2: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00c7: stloc.1
IL_00c8: ldloca.s V_1
IL_00ca: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_00cf: stloc.1
IL_00d0: ldloca.s V_1
IL_00d2: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_00d7: nop
IL_00d8: ldarg.0
IL_00d9: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00de: stloc.0
IL_00df: ldloca.s V_0
IL_00e1: dup
IL_00e2: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00e7: brtrue.s IL_00ec
IL_00e9: pop
IL_00ea: br.s IL_011b
IL_00ec: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00f1: stloc.1
IL_00f2: ldloca.s V_1
IL_00f4: ldarg.0
IL_00f5: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_00fa: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method1(int32)
IL_00ff: stloc.2
IL_0100: ldloca.s V_2
IL_0102: dup
IL_0103: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0108: brtrue.s IL_010d
IL_010a: pop
IL_010b: br.s IL_011b
IL_010d: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0112: stloc.1
IL_0113: ldloca.s V_1
IL_0115: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_011a: nop
IL_011b: ldarg.0
IL_011c: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0121: stloc.0
IL_0122: ldloca.s V_0
IL_0124: dup
IL_0125: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_012a: brtrue.s IL_012f
IL_012c: pop
IL_012d: br.s IL_014b
IL_012f: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0134: stloc.1
IL_0135: ldloca.s V_1
IL_0137: ldarg.0
IL_0138: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_013d: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method2(int32)
IL_0142: stloc.1
IL_0143: ldloca.s V_1
IL_0145: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_014a: nop
IL_014b: ldarg.0
IL_014c: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0151: stloc.0
IL_0152: ldloca.s V_0
IL_0154: dup
IL_0155: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_015a: brtrue.s IL_015f
IL_015c: pop
IL_015d: br.s IL_018e
IL_015f: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0164: stloc.1
IL_0165: ldloca.s V_1
IL_0167: ldarg.0
IL_0168: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_016d: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Item(int32)
IL_0172: stloc.2
IL_0173: ldloca.s V_2
IL_0175: dup
IL_0176: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_017b: brtrue.s IL_0180
IL_017d: pop
IL_017e: br.s IL_018e
IL_0180: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0185: stloc.1
IL_0186: ldloca.s V_1
IL_0188: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_018d: nop
IL_018e: ret
} // end of method NullPropagation::CallDoneStruct
.method public hidebysig instance void
RequiredParentheses() cil managed
{
// Code size 56 (0x38)
.maxstack 8
// Code size 131 (0x83)
.maxstack 2
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_2)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyClass()
@ -599,7 +770,40 @@ @@ -599,7 +770,40 @@
IL_002c: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Method(int32)
IL_0031: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::Done()
IL_0036: nop
IL_0037: ret
IL_0037: ldarg.0
IL_0038: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_003d: stloc.0
IL_003e: ldloca.s V_0
IL_0040: dup
IL_0041: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0046: brtrue.s IL_0054
IL_0048: pop
IL_0049: ldloca.s V_1
IL_004b: initobj valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>
IL_0051: ldloc.1
IL_0052: br.s IL_0066
IL_0054: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0059: stloc.2
IL_005a: ldloca.s V_2
IL_005c: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_0061: newobj instance void valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::.ctor(!0)
IL_0066: stloc.0
IL_0067: ldloca.s V_0
IL_0069: dup
IL_006a: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_006f: brtrue.s IL_0074
IL_0071: pop
IL_0072: br.s IL_0082
IL_0074: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0079: stloc.2
IL_007a: ldloca.s V_2
IL_007c: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Done()
IL_0081: nop
IL_0082: ret
} // end of method NullPropagation::RequiredParentheses
.method public hidebysig instance valuetype [mscorlib]System.Nullable`1<int32>[]
@ -815,6 +1019,257 @@ @@ -815,6 +1019,257 @@
IL_01de: ret
} // end of method NullPropagation::ChainsOnClass
.method public hidebysig instance valuetype [mscorlib]System.Nullable`1<int32>[]
ChainsStruct() cil managed
{
// Code size 589 (0x24d)
.maxstack 5
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype [mscorlib]System.Nullable`1<int32> V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct V_2,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_3,
valuetype [mscorlib]System.Nullable`1<int32>[] V_4)
IL_0000: nop
IL_0001: ldc.i4.8
IL_0002: newarr valuetype [mscorlib]System.Nullable`1<int32>
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldarg.0
IL_000a: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_000f: stloc.0
IL_0010: ldloca.s V_0
IL_0012: dup
IL_0013: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0018: brtrue.s IL_0026
IL_001a: pop
IL_001b: ldloca.s V_1
IL_001d: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0023: ldloc.1
IL_0024: br.s IL_0035
IL_0026: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_002b: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_0030: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0035: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_003a: dup
IL_003b: ldc.i4.1
IL_003c: ldarg.0
IL_003d: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0042: stloc.0
IL_0043: ldloca.s V_0
IL_0045: dup
IL_0046: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_004b: brtrue.s IL_0059
IL_004d: pop
IL_004e: ldloca.s V_1
IL_0050: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0056: ldloc.1
IL_0057: br.s IL_006d
IL_0059: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_005e: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_0063: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::IntVal
IL_0068: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_006d: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_0072: dup
IL_0073: ldc.i4.2
IL_0074: ldarg.0
IL_0075: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_007a: stloc.0
IL_007b: ldloca.s V_0
IL_007d: dup
IL_007e: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0083: brtrue.s IL_0091
IL_0085: pop
IL_0086: ldloca.s V_1
IL_0088: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_008e: ldloc.1
IL_008f: br.s IL_00b4
IL_0091: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0096: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Field
IL_009b: dup
IL_009c: brtrue.s IL_00aa
IL_009e: pop
IL_009f: ldloca.s V_1
IL_00a1: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_00a7: ldloc.1
IL_00a8: br.s IL_00b4
IL_00aa: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass::IntVal
IL_00af: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_00b4: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_00b9: dup
IL_00ba: ldc.i4.3
IL_00bb: ldarg.0
IL_00bc: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00c1: stloc.0
IL_00c2: ldloca.s V_0
IL_00c4: dup
IL_00c5: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_00ca: brtrue.s IL_00d8
IL_00cc: pop
IL_00cd: ldloca.s V_1
IL_00cf: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_00d5: ldloc.1
IL_00d6: br.s IL_00ef
IL_00d8: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_00dd: stloc.2
IL_00de: ldloca.s V_2
IL_00e0: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property2()
IL_00e5: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_00ea: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_00ef: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_00f4: dup
IL_00f5: ldc.i4.4
IL_00f6: ldarg.0
IL_00f7: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_00fc: stloc.0
IL_00fd: ldloca.s V_0
IL_00ff: dup
IL_0100: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0105: brtrue.s IL_0113
IL_0107: pop
IL_0108: ldloca.s V_1
IL_010a: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0110: ldloc.1
IL_0111: br.s IL_0146
IL_0113: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0118: stloc.2
IL_0119: ldloca.s V_2
IL_011b: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Property1()
IL_0120: stloc.3
IL_0121: ldloca.s V_3
IL_0123: dup
IL_0124: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0129: brtrue.s IL_0137
IL_012b: pop
IL_012c: ldloca.s V_1
IL_012e: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0134: ldloc.1
IL_0135: br.s IL_0146
IL_0137: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_013c: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_0141: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0146: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_014b: dup
IL_014c: ldc.i4.5
IL_014d: ldarg.0
IL_014e: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0153: stloc.0
IL_0154: ldloca.s V_0
IL_0156: dup
IL_0157: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_015c: brtrue.s IL_016a
IL_015e: pop
IL_015f: ldloca.s V_1
IL_0161: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0167: ldloc.1
IL_0168: br.s IL_0187
IL_016a: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_016f: stloc.2
IL_0170: ldloca.s V_2
IL_0172: ldarg.0
IL_0173: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0178: call instance valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method2(int32)
IL_017d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_0182: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0187: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_018c: dup
IL_018d: ldc.i4.6
IL_018e: ldarg.0
IL_018f: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_0194: stloc.0
IL_0195: ldloca.s V_0
IL_0197: dup
IL_0198: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_019d: brtrue.s IL_01ab
IL_019f: pop
IL_01a0: ldloca.s V_1
IL_01a2: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_01a8: ldloc.1
IL_01a9: br.s IL_01e4
IL_01ab: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_01b0: stloc.2
IL_01b1: ldloca.s V_2
IL_01b3: ldarg.0
IL_01b4: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_01b9: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::Method1(int32)
IL_01be: stloc.3
IL_01bf: ldloca.s V_3
IL_01c1: dup
IL_01c2: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_01c7: brtrue.s IL_01d5
IL_01c9: pop
IL_01ca: ldloca.s V_1
IL_01cc: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_01d2: ldloc.1
IL_01d3: br.s IL_01e4
IL_01d5: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_01da: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_01df: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_01e4: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_01e9: dup
IL_01ea: ldc.i4.7
IL_01eb: ldarg.0
IL_01ec: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetMyStruct()
IL_01f1: stloc.0
IL_01f2: ldloca.s V_0
IL_01f4: dup
IL_01f5: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_01fa: brtrue.s IL_0208
IL_01fc: pop
IL_01fd: ldloca.s V_1
IL_01ff: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_0205: ldloc.1
IL_0206: br.s IL_0241
IL_0208: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_020d: stloc.2
IL_020e: ldloca.s V_2
IL_0210: ldarg.0
IL_0211: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation::GetInt()
IL_0216: call instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::get_Item(int32)
IL_021b: stloc.3
IL_021c: ldloca.s V_3
IL_021e: dup
IL_021f: call instance bool valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::get_HasValue()
IL_0224: brtrue.s IL_0232
IL_0226: pop
IL_0227: ldloca.s V_1
IL_0229: initobj valuetype [mscorlib]System.Nullable`1<int32>
IL_022f: ldloc.1
IL_0230: br.s IL_0241
IL_0232: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>::GetValueOrDefault()
IL_0237: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct::IntVal
IL_023c: newobj instance void valuetype [mscorlib]System.Nullable`1<int32>::.ctor(!0)
IL_0241: stelem valuetype [mscorlib]System.Nullable`1<int32>
IL_0246: stloc.s V_4
IL_0248: br.s IL_024a
IL_024a: ldloc.s V_4
IL_024c: ret
} // end of method NullPropagation::ChainsStruct
.method public hidebysig instance int32
CoalescingReturn() cil managed
{
@ -1195,7 +1650,7 @@ @@ -1195,7 +1650,7 @@
IL_0006: ldnull
IL_0007: br IL_015c
IL_000c: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_000c: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_0011: brfalse.s IL_0015
IL_0013: br.s IL_004f
@ -1227,11 +1682,11 @@ @@ -1227,11 +1682,11 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_0045: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_004a: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_004f: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_004a: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_004f: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_0054: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Target
IL_0059: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__1'
IL_005e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0059: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__1'
IL_005e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_0063: brfalse.s IL_0067
IL_0065: br.s IL_0096
@ -1254,10 +1709,10 @@ @@ -1254,10 +1709,10 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_008c: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_0091: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0096: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_0091: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_0096: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_009b: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Target
IL_00a0: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__0'
IL_00a0: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__0'
IL_00a5: ldloc.0
IL_00a6: callvirt instance !2 class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>::Invoke(!0,
!1)
@ -1272,7 +1727,7 @@ @@ -1272,7 +1727,7 @@
IL_00b5: ldnull
IL_00b6: br IL_015c
IL_00bb: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00bb: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00c0: brfalse.s IL_00c4
IL_00c2: br.s IL_00f8
@ -1300,11 +1755,11 @@ @@ -1300,11 +1755,11 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_00ee: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_00f3: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00f8: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_00f3: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00f8: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_00fd: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>>::Target
IL_0102: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__3'
IL_0107: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_0102: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite,object,int32,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__3'
IL_0107: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_010c: brfalse.s IL_0110
IL_010e: br.s IL_0140
@ -1327,10 +1782,10 @@ @@ -1327,10 +1782,10 @@
class [mscorlib]System.Type,
class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
IL_0136: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
IL_013b: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_0140: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_013b: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_0140: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_0145: ldfld !0 class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>>::Target
IL_014a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__26'::'<>p__2'
IL_014a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/'<>o__27'::'<>p__2'
IL_014f: ldloc.1
IL_0150: callvirt instance !2 class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite,object,object>::Invoke(!0,
!1)

12
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -244,7 +244,17 @@ namespace ICSharpCode.Decompiler.IL @@ -244,7 +244,17 @@ namespace ICSharpCode.Decompiler.IL
hasInitialValue = value;
}
}
/// <summary>
/// Gets whether the variable is in SSA form:
/// There is exactly 1 store, and every load sees the value from that store.
/// </summary>
/// <remarks>
/// Note: the single store is not necessary a store instruction, it might also
/// be the use of the implicit initial value.
/// For example: for parameters, IsSingleDefinition will only return true if
/// the parameter is never assigned to within the function.
/// </remarks>
public bool IsSingleDefinition {
get {
return StoreCount == 1 && AddressCount == 0;

87
ICSharpCode.Decompiler/IL/Transforms/SplitVariables.cs

@ -49,9 +49,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -49,9 +49,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms
case VariableKind.Local:
case VariableKind.Exception:
foreach (var ldloca in v.AddressInstructions) {
if (DetermineAddressUse(ldloca) == AddressUse.Unknown) {
// If the address isn't used immediately,
// we'd need to deal with aliases.
if (DetermineAddressUse(ldloca, ldloca.Variable) == AddressUse.Unknown) {
// If we don't understand how the address is being used,
// we can't split the variable.
return false;
}
}
@ -73,20 +73,37 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -73,20 +73,37 @@ namespace ICSharpCode.Decompiler.IL.Transforms
enum AddressUse
{
Unknown,
LocalRead,
LocalReadWrite
/// <summary>
/// Address is immediately used for reading and/or writing,
/// without the possibility of the variable being directly stored to (via 'stloc')
/// in between the 'ldloca' and the use of the address.
/// </summary>
Immediate,
/// <summary>
/// We support some limited form of ref locals referring to a target variable,
/// without giving up splitting of the target variable.
/// Requirements:
/// * the ref local is single-assignment
/// * the ref local is initialized directly with 'ldloca target; stloc ref_local',
/// not a derived pointer (e.g. 'ldloca target; ldflda F; stloc ref_local').
/// * all uses of the ref_local are immediate.
/// There may be stores to the target variable in between the 'stloc ref_local' and its uses,
/// but we handle that case by treating each use of the ref_local as an address access
/// of the target variable (as if the ref_local was eliminated via copy propagation).
/// </summary>
WithSupportedRefLocals,
}
static AddressUse DetermineAddressUse(ILInstruction addressLoadingInstruction)
static AddressUse DetermineAddressUse(ILInstruction addressLoadingInstruction, ILVariable targetVar)
{
switch (addressLoadingInstruction.Parent) {
case LdObj ldobj:
return AddressUse.LocalRead;
return AddressUse.Immediate;
case LdFlda ldflda:
return DetermineAddressUse(ldflda);
return DetermineAddressUse(ldflda, targetVar);
case Await await:
// GetAwaiter() may write to the struct, but shouldn't store the address for later use
return AddressUse.LocalReadWrite;
return AddressUse.Immediate;
case Call call:
// Address is passed to method.
// We'll assume the method only uses the address locally,
@ -99,21 +116,47 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -99,21 +116,47 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (p.Type.SkipModifiers() is ByReferenceType brt && brt.ElementType.IsByRefLike)
return AddressUse.Unknown;
}
/* Currently there's not really any need to distinguish between readonly and readwrite method calls:
var addrParam = call.GetParameter(addressLoadingInstruction.ChildIndex);
bool isReadOnly;
if (addrParam == null) {
isReadOnly = (call.Method.DeclaringTypeDefinition?.HasAttribute(KnownAttribute.IsReadOnly) ?? false)
|| (call.Method.DeclaringType?.IsKnownType(KnownTypeCode.NullableOfT) ?? false);
} else {
isReadOnly = false;
}*/
return AddressUse.LocalReadWrite;
// ensure there's no 'stloc target' in between the ldloca and the call consuming the address
for (int i = addressLoadingInstruction.ChildIndex + 1; i < call.Arguments.Count; i++) {
foreach (var inst in call.Arguments[i].Descendants) {
if (inst is StLoc store && store.Variable == targetVar)
return AddressUse.Unknown;
}
}
return AddressUse.Immediate;
case StLoc stloc when stloc.Variable.IsSingleDefinition:
// Address stored in local variable: also check all uses of that variable.
if (!(stloc.Variable.Kind == VariableKind.StackSlot || stloc.Variable.Kind == VariableKind.Local))
return AddressUse.Unknown;
if (stloc.Value.OpCode != OpCode.LdLoca) {
// GroupStores.HandleLoad() only detects ref-locals when they are directly initialized with ldloca
return AddressUse.Unknown;
}
foreach (var load in stloc.Variable.LoadInstructions) {
if (DetermineAddressUse(load, targetVar) != AddressUse.Immediate)
return AddressUse.Unknown;
}
return AddressUse.WithSupportedRefLocals;
default:
return AddressUse.Unknown;
}
}
/// <summary>
/// Given 'ldloc ref_local' and 'ldloca target; stloc ref_local', returns the ldloca.
/// This function must return a non-null LdLoca for every use of a SupportedRefLocal.
/// </summary>
static LdLoca GetAddressLoadForRefLocalUse(LdLoc ldloc)
{
if (!ldloc.Variable.IsSingleDefinition)
return null; // only single-definition variables can be supported ref locals
var store = ldloc.Variable.StoreInstructions.SingleOrDefault();
if (store is StLoc stloc) {
return stloc.Value as LdLoca;
}
return null;
}
/// <summary>
/// Use the union-find structure to merge
/// </summary>
@ -139,6 +182,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -139,6 +182,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms
{
base.VisitLdLoc(inst);
HandleLoad(inst);
var refLocalAddressLoad = GetAddressLoadForRefLocalUse(inst);
if (refLocalAddressLoad != null) {
// SupportedRefLocal: act as if we copy-propagated the ldloca
// to the point of use:
HandleLoad(refLocalAddressLoad);
}
}
protected internal override void VisitLdLoca(LdLoca inst)

Loading…
Cancel
Save