blob: cf077786d9652eaf16185ff91774377a6247e92d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// This test checks that value numbering does not incorrectly propagate the value number for an operand to its
// consuming operator unless the type of the operand and the operator agree.
//
// In particular, in the body of method N, the optimizer will fold the two `ceq` conditions together using a logical
// or of type int32. Value numbering will then determine that one operand to the logical or is a constant `0` (namely,
// the result of `ldloc.0` and attempt to propagate the value number of the logical or's other operand to the logical
// or itself. This should not succeed, as the type of the logical or is int32 and the type of its non-zero operand is
// `ref`.
.assembly extern mscorlib {}
.assembly r {}
.class private auto ansi beforefieldinit C extends [mscorlib]System.Object
{
.method private hidebysig static int32 N(object o) cil managed noinlining
{
.locals (int32)
ldc.i4.0
stloc.0
ldarg.0
isinst C
ldnull
ceq
brfalse.s label
ldloc.0
ldc.i4.0
ceq
brfalse.s label
ldc.i4.s 0
ret
label:
ldc.i4 100
ret
}
.method private hidebysig static int32 Main(string[] args) cil managed
{
.entrypoint
newobj instance void C::.ctor()
call int32 C::N(object)
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
|