New test.
[mono.git] / mono / mini / iltests.il
1 .assembly iltests {}
2 .assembly extern TestDriver {}
3 .assembly extern mscorlib {}
4
5 .class public auto ansi sealed beforefieldinit Tests {
6
7         .method static public int32 Main(string[] args) il managed {
8                 .entrypoint
9                 
10                 ldtoken Tests
11                 call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
12                 ldarg.0
13                 call       int32 [TestDriver]TestDriver::RunTests(class [mscorlib]System.Type, string[])
14                 ret
15         }
16
17         // make sure the register allocator works when the return value of
18         // 'div' is discarded
19         .method static public int32 test_0_div_regalloc () il managed {
20                 .locals init (
21                         int32 i
22                 )
23
24                 ldloc 0
25                 ldc.i4.s 0xa
26                 div
27                 pop
28                 ldc.i4.0
29                 ret
30         }
31         
32         
33         .method static public int32 test_1_ceq_to_i4 () il managed {
34                 .locals init (
35                         int32   foo
36                 )
37                 ldc.i4 500
38                 stloc foo
39                 ldloc foo
40                 ldc.i4 500
41                 ceq
42                 stloc foo
43                 ldloc foo
44                 ret
45         }
46         
47         .method static public int32 test_3_shl_regvars () il managed {
48                 .locals init (
49                         int32   a,
50                         int32   b,
51                         int32   r1,
52                         int32   r2,
53                         int32   r3
54                 )
55                         
56                 ldc.i4.2
57                 stloc      a
58                 ldc.i4.1
59                 stloc      b
60         
61                 ldloc      a
62                 ldloc      b
63                 shl 
64                 stloc      r1
65                 
66                 ldloc      a
67                 ldloc      b
68                 shl 
69                 stloc      r2
70                 
71                 ldloc      a
72                 ldloc      b
73                 shl 
74                 stloc      r3
75                 
76                 ldloc      r1
77                 ldc.i4.4
78                 ceq
79                 
80                 ldloc      r2
81                 ldc.i4.4
82                 ceq
83                 
84                 ldloc      r3
85                 ldc.i4.4
86                 ceq
87                 
88                 add
89                 add
90                 
91                 ret
92         }
93         
94         .method static public int32 test_1_fceq_to_i4 () il managed {
95         
96                 .locals init (
97                         float64 foo,
98                         int32   val
99                 )
100
101                 ldc.r8      2
102                 stloc       foo
103                 
104                 ldloc       foo
105                 ldc.r8      2
106                 ceq
107                 stloc       val
108                 
109                 ldloc       val
110                 ret
111         }
112
113         //
114         // This should be manually checked. Basically under -O=linears,
115         // you should not see tons of register spilling.
116         //
117         .method static public int32 test_1_bytedreg_free () il managed {
118                 .locals init (
119                         int32   foo
120                 )
121                 ldc.i4 500
122                 stloc foo
123                 ldloc foo
124                 ldc.i4 500
125                 ceq
126                 stloc foo
127                 
128                 ldloc foo
129                 ldc.i4 1
130                 ceq
131                 stloc foo
132
133                 ldloc foo
134                 ldc.i4 1
135                 ceq
136                 stloc foo
137
138                 ldloc foo
139                 ldc.i4 1
140                 ceq
141                 stloc foo
142                 
143                 ldloc foo
144                 ldc.i4 1
145                 ceq
146                 stloc foo
147                 
148                 ldloc foo
149                 ret
150         }
151         
152         //
153         // This should be manually checked. Basically under -O=linears,
154         // you should not see tons of register spilling.
155         //
156         .method static public int32 test_0_bytesreg1_free () il managed {
157                 .locals init (
158                         unsigned int8      dest,
159                         int32              src,
160                         unsigned int8&     pdest
161                 )
162
163                 ldloca     dest
164                 stloc      pdest
165                 
166                 ldloc      pdest
167                 ldloc      src
168                 stind.i1
169                 
170                 ldloc      pdest
171                 ldloc      src
172                 stind.i1
173                 
174                 ldloc      pdest
175                 ldloc      src
176                 stind.i1
177                 
178                 ldloc      pdest
179                 ldloc      src
180                 stind.i1
181                 
182                 ldloc      pdest
183                 ldloc      src
184                 stind.i1
185                 
186                 ldloc      pdest
187                 ldloc      src
188                 stind.i1
189                 
190                 ldloc      pdest
191                 ldind.i1
192                 ret
193         }
194         
195         .method static public int32 test_1_shift_regvar () il managed {
196         
197                 .locals init (
198                         int32   v7FFFFFFF,
199                         int32   v1
200                 )
201                 
202                 ldc.i4  0x7FFFFFFF
203                 stloc   v7FFFFFFF
204         
205                 ldc.i4.1
206                 stloc v1
207                 
208                 ldloc   v7FFFFFFF
209                 ldloc   v1
210                 shl
211                 ldc.i4  0xFFFFFFFE
212                 ceq
213                 ret
214         }
215         
216         // this only happens with the managed pointer, not an unmanaged one.
217         .method static public int32 test_0_foo () il managed {
218         
219                 .locals init (
220                         int32&  buf
221                 )
222                 
223                 ldc.i4.5
224                 localloc
225                 
226                 stloc buf
227                 ldloc buf
228                 
229                 ldind.i4
230                 
231                 ret
232         }
233
234         .method static public int32 test_0_localloc () cil managed {
235                 .locals init (native int, native int, native int, native int, int32)
236
237                 ldc.i4 6
238                 localloc
239                 conv.i
240                 stloc.0
241
242                 ldc.i4 6
243                 localloc
244                 conv.i
245                 stloc.1
246
247                 ldc.i4 6
248                 localloc
249                 conv.i
250                 stloc.2
251
252                 // Variable length
253                 ldc.i4 128
254                 stloc.s 4
255                 ldloc.s 4
256                 localloc
257                 conv.i
258                 stloc.3
259
260                 // Check zero initialized
261                 ldloc.0
262                 ldind.i4
263                 ldc.i4.0
264                 beq OK1
265                 ldc.i4.1
266                 br FAIL
267
268 OK1:
269                 ldloc.3
270                 ldind.i4
271                 ldc.i4.0
272                 beq OK2
273                 ldc.i4.2
274                 br FAIL
275
276 OK2:
277                 ldloc.3
278                 ldc.i4.s 124
279                 add
280                 ldind.i4
281                 ldc.i4.0
282                 beq OK3
283                 ldc.i4.3
284                 br FAIL
285
286 OK3:
287                 ldloc.1
288                 ldc.i4 999999
289                 stind.i4
290                 ldloc.1
291                 ldind.i4
292                 ldc.i4 999999
293                 beq OK4
294                 ldc.i4.4
295                 br FAIL
296
297 OK4:
298                 ldloc.0
299                 ldc.i4 999999
300                 stind.i4
301                 ldloc.0
302                 ldind.i4
303                 ldc.i4 999999
304                 beq OK5
305                 ldc.i4.5
306                 br FAIL
307
308 OK5:
309                 // Try allocations bigger than one page
310                 ldc.i4 8196
311                 localloc
312                 conv.i
313                 stloc.3
314                 ldloc.3
315                 ldc.i4 8192
316                 add
317                 ldc.i4 99
318                 stind.i4
319                 ldloc.3
320                 ldc.i4 8192
321                 add
322                 ldind.i4
323                 ldc.i4 99
324                 beq PASS
325                 ldc.i4.6
326                 br FAIL
327
328 FAIL:
329                 ret
330
331 PASS:   ldc.i4.0
332                 ret
333         }
334
335     .method private static void do_localloc () cil managed {
336         .maxstack 3
337         .locals init (
338                 unsigned int8*  V_0)
339         IL_0000:  ldc.i4.1
340         IL_0001:  ldc.i4 131072
341         IL_0006:  mul
342         IL_0007:  localloc
343         IL_0009:  stloc.0
344         IL_000a:  ret
345     }
346
347         // Check that localloc can't be inlined
348         .method static public int32 test_0_localloc_inline () cil managed {
349                 .maxstack 16
350                 .locals init (
351                         int32 i
352                 )
353
354                 ldc.i4.0
355         stloc.0
356         br COND
357
358 START:  call void class Tests::do_localloc()
359         ldloc.0
360         ldc.i4.1
361         add
362         stloc.0
363 COND:   ldloc.0
364         ldc.i4 1000
365         blt START
366
367                 ldc.i4.0
368                 ret
369         }       
370         
371         .method static public int32 test_3_copy_used_bug () il managed {
372
373                 .locals init (
374                         int32 size,
375                         int32 res
376                 )
377
378                 ldc.i4 0
379                 stloc res
380
381                 ldc.i4 1
382                 stloc size
383
384                 ldloc size
385                 ldloc size
386                 ldloc size
387                 add
388                 stloc size
389                 ldloc size
390                 add
391                 stloc res
392
393                 ldloc res
394                 ret
395         }
396
397         // demonstrate that the copy_used_var is not a fix for the above bug
398         .method static public int32 test_3_copy_used_indir_bug () il managed {
399
400                 .locals init (
401                         int32 size,
402                         int32 res
403                 )
404
405                 ldc.i4 0
406                 stloc res
407
408                 ldc.i4 1
409                 stloc size
410
411                 ldloc size
412                 ldloca size
413                 ldloc size
414                 ldloc size
415                 add
416                 stind.i4
417                 ldloc size
418                 add
419                 stloc res
420
421                 ldloc res
422                 ret
423         }
424
425         .method static public void do_nothing (int32 a) il managed {
426                 ret
427         }
428         
429         // demonstrate the block_split failure: needs -O=inline
430         // mini -O=inline --compile Tests:test_0_split_block_bug iltests.exe
431         .method static public int32 test_0_split_block_bug () il managed {
432
433                 .locals init (
434                         int32 i1
435                 )
436
437                 ldc.i4 1
438                 stloc i1
439  test_label:
440                 ldloc i1
441                 call void class Tests::do_nothing (int32)
442                 ldc.i4 0
443                 brtrue test_label
444                 
445                 ldc.i4 0
446                 ret
447         }
448
449         .method public void inline_do_nothing () il managed {
450                 ret
451         }
452         .method static public int32 test_1_checkthis_inlining () il managed {
453                 ldnull
454                 call instance void class Tests::inline_do_nothing ()
455                 ldc.i4 1
456                 ret
457         }
458
459         .class nested private auto ansi sealed beforefieldinit TailCallStruct 
460                 extends [mscorlib]System.ValueType {
461                 .field public int32 a
462                 .field public int32 b
463         }
464
465         .method static valuetype Tests/TailCallStruct tail1 (valuetype Tests/TailCallStruct arg) {
466                 ldarga 0
467                 ldarga 0
468                 ldfld int32 Tests/TailCallStruct::a
469                 ldc.i4.1
470                 add
471                 stfld int32 Tests/TailCallStruct::a
472                 ldarga 0
473                 ldarga 0
474                 ldfld int32 Tests/TailCallStruct::a
475                 ldc.i4.2
476                 add
477                 stfld int32 Tests/TailCallStruct::a
478                 ldarg.0
479                 ret
480         }
481
482         .method static valuetype Tests/TailCallStruct tail2 (valuetype Tests/TailCallStruct arg) {
483                 ldarg.0
484                 tail.
485                 call valuetype Tests/TailCallStruct Tests::tail1 (valuetype Tests/TailCallStruct)
486                 ret
487         }
488
489         .method static public int32 test_0_tail_calls () il managed {
490                 .maxstack 16
491                 .locals init (
492                         valuetype Tests/TailCallStruct arg
493                 )
494                 ldloca 0
495                 ldc.i4.2
496                 stfld int32 Tests/TailCallStruct::a
497                 ldloca 0
498                 ldc.i4.4
499                 stfld int32 Tests/TailCallStruct::b
500                 ldloc.0
501                 call valuetype Tests/TailCallStruct Tests::tail2 (valuetype Tests/TailCallStruct)
502                 stloc.0
503                 ldloca 0
504                 ldfld int32 Tests/TailCallStruct::a
505                 ldloca 0
506                 ldfld int32 Tests/TailCallStruct::b
507                 add
508                 ldc.i4 9
509                 sub
510                 ret
511         }
512
513         .method static public int32 tail3 (int32 i, int32 j) il managed {
514                 ldarg.0
515                 ldarg.1
516                 add
517                 ret
518         }
519
520         .method static public int32 tail4 (int32 i, int32 j) il managed {
521                 .maxstack 16
522                 .locals init (
523                         int32 k)
524
525                 // Test arg0 allocated to a register
526                 ldarg.0
527                 ldarg.0
528                 ldarg.0
529                 ldarg.0
530                 add
531                 add
532                 add
533                 starg 0
534
535                 // Test switched up argument variables as the actual arguments
536                 ldarg.1
537                 ldarg.0
538                 tail.
539                 call int32 Tests::tail3 (int32, int32)
540                 ret
541         }
542
543         .method static public int32 test_24_tail_calls2 () il managed {
544                 .maxstack 16
545                 .locals init (
546                         int32 i,
547                         int32 j)
548
549                 ldc.i4.4
550                 stloc.0
551                 ldc.i4.8
552                 stloc.1
553
554                 ldloc.0 
555                 ldloc.1
556                 call int32 Tests::tail4 (int32, int32)
557                 ret
558         }
559
560         .method public static int32 test_5_jmp () cil managed {
561                 jmp int32 Tests::jmp2 ()
562                 ldc.i4.0
563                 ret
564         }
565
566         .method public static int32 jmp2 () cil managed {
567                 ldc.i4.5
568                 ret
569         }               
570
571         .method static public int32 test_11_switch_with_nonempty_stack () il managed {
572                 .maxstack 16
573
574                 ldc.i4.5
575                 ldc.i4.6
576                 ldc.i4.1
577                 switch (L0, L1)
578         L0: 
579                 add
580                 ret
581         L1:
582                 add
583                 ret
584         }
585  
586     .method public static int32 test_5_endfinally_with_nonempty_stack () il managed {
587                 .maxstack 16
588
589         .try {
590           leave IL_0
591         }
592         finally  {
593           ldc.i4.0
594           endfinally
595         }
596         IL_0:  ldc.i4.5
597                 ret
598     }
599
600         .method public static int32 test_0_conv_ovf_i8_neg () il managed {
601                 .maxstack 16
602
603                 ldc.i4.m1
604                 conv.ovf.i8
605                 conv.i4
606                 ldc.i4.m1
607                 beq L_OK
608                 ldc.i4.1
609                 ret
610         L_OK:
611                 ldc.i4.0
612                 ret
613         }               
614
615         .method public static int32 test_1234_conv_u4 () il managed {
616                 .maxstack 16
617
618                 ldc.i4 1234
619                 conv.u4
620                 conv.i4
621                 ret
622         }
623
624         .method public static int32 test_0_get_type_from_handle_on_bblock_boundary () cil managed 
625         {
626                 .maxstack 16
627         
628                 ldc.i4.1
629                 brfalse OBJECT
630         
631                 ldtoken [mscorlib]System.String
632                 br AFTER
633         OBJECT:
634                 ldtoken [mscorlib]System.Object
635         AFTER:
636                 call class [mscorlib]'System.Type' class [mscorlib]'System.Type'::'GetTypeFromHandle'(valuetype [mscorlib]'System.RuntimeTypeHandle')
637                 callvirt instance string class [mscorlib]System.Type::get_FullName ()
638                 ldstr "System.String"
639                 callvirt instance bool class [mscorlib]System.Object::Equals(object)
640                 ldc.i4.0
641                 ceq
642                 ret 
643         }
644                 
645         .method public static int32 test_0_bug59580  ()
646         {
647                 ldc.r4          float32(0x7FC00000)
648                 ldc.r4          float32(0x7FC00000)
649                 bge.un          pass
650                 br              fail
651         pass:
652                 ldc.i4.0
653                 ret
654         fail:
655                 ldc.i4.1
656                 ret
657         }
658         
659         .method public static int32 test_1_bug60056  () {
660                 .locals init (int32 m5)
661                         
662                 ldc.i4.m1
663                 stloc.0
664                 
665                 ldc.i4.1
666                 conv.u8
667                 
668                 ldloc.0
669                 conv.i8
670                 mul
671                 
672                 ldc.i4.m1
673                 conv.i8
674                 ceq
675                 ret
676         }
677         
678         .method public static int32 test_1_conv_u8_cfold  () {
679                 ldc.i4.m1
680                 conv.u8
681                 
682                 ldc.i8 0x00000000ffffffff
683                 
684                 ceq
685                 ret
686         }
687         
688         .method public static int32 test_1_array_type_mismatch_ldelema  () {
689                 .locals init (int32 r)
690                 
691                         ldc.i4.1
692                         newarr string
693                         ldc.i4.0 
694                         ldelema string
695                         pop
696                 
697                 .try {
698                         ldc.i4.1
699                         newarr string
700                         ldc.i4.0 
701                         ldelema object
702                         pop
703                         
704                         leave end
705                 } catch [mscorlib]System.ArrayTypeMismatchException {
706                         pop
707                         ldc.i4.1
708                         stloc.0
709                         leave end
710                 }
711         end:
712                 ldloc.0
713                 ret
714         }
715
716         .method public static int32 test_1_conv_ovf_i8_with_i4 () {
717                         ldc.i4.m1 
718                         conv.ovf.i8
719                         conv.ovf.i4
720                         neg
721                         ret
722         }
723
724         // bug #72148
725     .method public static int32 test_0_initlocals_float_ptr () {
726         .maxstack 3
727         .locals init (
728                 float32[]       V_0,
729                 float32& pinned V_1,
730                 unsigned int32  V_2)
731                         ldc.i4.s 0x0f
732                         newarr [mscorlib]System.Single
733                         stloc.0 
734                         ldloc.0 
735                         ldc.i4.0 
736                         ldc.r4 1.13
737                         stelem.r4 
738                         ldloc.0 
739                         ldc.i4.0 
740                         ldelema [mscorlib]System.Single
741                         stloc.1 
742                         ldloc.1 
743                         conv.i 
744                         ldind.u4 
745                         stloc.2 
746                         ldc.i4.0
747                         ret
748         }
749
750         .method public static int32 test_7_conv_ovf_u8_un () {
751         .maxstack  2
752         .locals    init (unsigned int64)
753
754         ldc.i4.7
755         conv.ovf.u8.un
756         stloc.0
757                 ldloc.0
758                 conv.i4
759         ret
760         }
761
762         .method public static int32 test_1_bug_74591 () {
763                 .maxstack 16
764                 .locals init (int32)
765
766                 ldc.i4.m1
767                 stloc.0
768                 ldloc.0
769                 conv.ovf.i8
770                 ldc.i4.m1
771                 conv.ovf.i8
772                 mul.ovf
773                 conv.i4
774                 ret
775         }
776
777         .class nested public auto ansi Integer
778                 extends [mscorlib]System.Object {
779
780                 .field public bool n
781
782             .method public hidebysig  specialname  rtspecialname 
783            instance default void .ctor (unsigned int64 i, bool n)  cil managed 
784             {
785                         .maxstack 8
786                         ldarg.0
787                         call instance void class [mscorlib]System.Object::.ctor()
788                         ldarg.0
789                         ldarg.2
790                         stfld bool Tests/Integer::n
791                         ret
792                 }
793         }
794
795         .method public static int32 test_1_bug_74726 () {
796                 .maxstack 16
797
798                 ldc.i4.2
799                 conv.ovf.u8
800                 ldc.i4.1
801                 conv.ovf.u8
802                 mul.ovf.un
803                 ldc.i4.1
804                 newobj instance void class Tests/Integer::.ctor(unsigned int64, bool)
805                 ldfld bool Tests/Integer::n
806                 ldc.i4.1
807                 ceq
808                 ret
809         }
810
811         .class nested private auto ansi sealed xxx
812         extends [mscorlib]System.ValueType
813    {
814      .field  public   object a
815
816      .method public hidebysig  specialname  rtspecialname 
817             instance default void .ctor ()  cil managed 
818      {
819                  .maxstack 8
820                  ret 
821      }
822    } // end of class xxx
823
824         .method public static int32 test_0_newobj_vtype () {
825                 .maxstack 6
826                 .locals init (
827                         valuetype Tests/xxx V_0
828                 )
829
830                 newobj instance void valuetype Tests/xxx::.ctor ()
831                 stloc.0
832                 ldloca.s 0
833                 ldfld object Tests/xxx::a
834                 brfalse OK
835                 ldc.i4.s 1
836                 ret
837         OK:
838                 ldc.i4.s 0
839                 ret
840         }
841
842         .method public static int32 test_1_filters () {
843                 .maxstack 16
844                 .locals init (
845                         int32 res
846                 )
847
848                 .try { // 0
849                         .try {
850                                 ldstr "OnErrorSub test Exception"
851                                 newobj instance void class [mscorlib]System.Exception::.ctor(string)
852                                 throw 
853                                 leave.s IL_0033
854                         }
855                         filter {
856                                 pop
857                                 ldc.i4.0
858                                 endfilter
859                         } {
860                                 pop
861                                 // Should not be called
862                                 ldc.i4.2
863                                 stloc res
864                                 leave.s IL_0033
865                         }
866                 }
867                 filter {
868                         pop
869                         ldc.i4.1
870                         endfilter 
871                 } {
872                   pop
873                   ldc.i4.1
874                   stloc res       
875                   leave.s IL_0033
876
877                 }
878                 IL_0033:
879                 ldloc res
880                 ret
881         }
882
883         .class nested private auto ansi sealed beforefieldinit TheStruct
884                 extends [mscorlib]System.ValueType {
885                 .field public int32 a
886                 .field public int32 b
887         }
888
889         .method public static int32 test_5_cpobj () {
890                 .maxstack 8
891                 .locals init (  
892                                 valuetype Tests/TheStruct v_0, 
893                                 valuetype Tests/TheStruct v_1
894                                          )
895
896                 ldloca v_0
897                 ldc.i4.2
898                 stfld int32 Tests/TheStruct::a
899
900                 ldloca v_0
901                 ldc.i4.3
902                 stfld int32 Tests/TheStruct::b
903
904                 ldloca v_1
905                 ldloca v_0
906                 cpobj Tests/TheStruct
907
908                 ldloca v_1
909                 ldfld int32 Tests/TheStruct::a
910                 ldloca v_1
911                 ldfld int32 Tests/TheStruct::b
912                 add
913
914                 ret
915         }
916
917         .method public static int32 test_5_ldobj_stloc_optimization () {
918                 .maxstack 8
919                 .locals init (  
920                                 valuetype Tests/TheStruct v_0, 
921                                 valuetype Tests/TheStruct v_1
922                                          )
923
924                 ldloca v_0
925                 ldc.i4.2
926                 stfld int32 Tests/TheStruct::a
927
928                 ldloca v_0
929                 ldc.i4.3
930                 stfld int32 Tests/TheStruct::b
931
932                 ldloca v_0
933                 ldobj valuetype Tests/TheStruct
934                 stloc.s v_1
935
936                 ldloca v_1
937                 ldfld int32 Tests/TheStruct::a
938                 ldloca v_1
939                 ldfld int32 Tests/TheStruct::b
940                 add
941
942                 ret
943         }
944
945         .method public static int32 test_1_cpobj_reference () {
946                 .maxstack 8
947                 .locals init (  
948                                 object v_0, 
949                                 object v_1
950                                          )
951
952                 newobj instance void object::.ctor()
953                 stloc v_0
954
955                 ldloca v_1
956                 ldloca v_0
957                 cpobj object
958
959                 ldloc v_0
960                 ldloc v_1
961                 ceq
962                 ret
963         }
964
965         .method public static int32 test_1_initobj_reference () {
966                 .maxstack 8
967                 .locals init (  
968                                 object v_0
969                                          )
970
971                 newobj instance void object::.ctor()
972                 stloc v_0
973
974                 ldloca v_0
975                 initobj object
976
977                 ldloc v_0
978                 ldnull
979                 ceq
980                 ret
981         }
982
983         .method public static int32 test_1_ldobj_reference () {
984                 .maxstack 8
985                 .locals init (  
986                                 object v_0
987                                          )
988
989                 newobj instance void object::.ctor()
990                 stloc v_0
991
992                 ldloc v_0
993                 ldloca v_0
994                 ldobj object
995                 ceq
996                 ret
997         }
998
999         .method public static int32 test_5_vtype_on_bb_boundary () {
1000                 .maxstack 8
1001                 .locals init (  
1002                                 valuetype Tests/TheStruct v_0, 
1003                                 valuetype Tests/TheStruct v_1
1004                                          )
1005
1006                 ldloca v_0
1007                 ldc.i4.2
1008                 stfld int32 Tests/TheStruct::a
1009
1010                 ldloca v_0
1011                 ldc.i4.3
1012                 stfld int32 Tests/TheStruct::b
1013
1014                 ldloc v_0
1015                 br L_0
1016         L_0: stloc v_1
1017
1018                 ldloca v_1
1019                 ldfld int32 Tests/TheStruct::a
1020                 ldloca v_1
1021                 ldfld int32 Tests/TheStruct::b
1022                 add
1023                 ret
1024         }
1025
1026         .method public static int32 test_3_larray_get_set () {
1027                 .locals init (
1028                         int32[2]        V_0)
1029                           
1030                         ldc.i4.2 
1031                         newobj instance void int32[0...]::.ctor(int32)
1032                         stloc.0 
1033                         ldloc.0 
1034                         ldc.i4.0 
1035                         ldc.i4 1
1036                         call instance void int32[0...]::Set(int32, int32)
1037                     ldloc.0 
1038                     ldc.i4.1 
1039                         ldc.i4 2
1040                         call instance void int32[0...]::Set(int32, int32)
1041
1042                         ldloc.0
1043                         ldc.i4.0
1044                         call instance int32 int32[0...]::Get(int32)
1045                         ldloc.0
1046                         ldc.i4.1
1047                         call instance int32 int32[0...]::Get(int32)
1048                         add
1049                         ret
1050         }
1051
1052         .method public static void regalloc_regress_78314_helper (object o) cil managed
1053         {
1054                 ret
1055         }
1056
1057         .method public static int32 test_1_regalloc_regress_78314 () cil managed
1058         {
1059     // Code size       68 (0x44)
1060     .maxstack  6
1061     .locals init (int32 V_0, bool V_1)
1062     IL_0000:  ldc.i4.0
1063     IL_0001:  stloc.0
1064     IL_0002:  br.s       IL_003b
1065
1066     IL_0004:
1067     IL_001e:  ldc.i4.s   10
1068     IL_0020:  ldloc.0
1069     IL_0021:  shl
1070     IL_0022:  ldc.i4.s   10
1071     IL_0024:  ldloc.0
1072     IL_0025:  shl
1073     IL_0026:  ceq
1074     IL_0028:  box        [mscorlib]System.Boolean
1075     IL_0032:  call       void Tests::regalloc_regress_78314_helper(object)
1076     IL_0037:  ldloc.0
1077     IL_0038:  ldc.i4.1
1078     IL_0039:  add
1079     IL_003a:  stloc.0
1080     IL_003b:  ldloc.0
1081     IL_003c:  ldc.i4.8
1082     IL_003f:  blt.s      IL_0004
1083
1084         ldloc.0
1085         ldc.i4.8
1086         ceq
1087         conv.i4
1088         ret     
1089   }
1090
1091         .method public static void try_block_end_remove_if_useless () cil managed {
1092             .maxstack  8
1093
1094             T_START:
1095                 ldstr   "Start"
1096                         pop
1097                 leave.s COMPLETE
1098             T1_END:
1099
1100             COMPLETE:
1101                 ret
1102
1103             F1_START:
1104                 ldstr   "Finally1"
1105                         pop
1106                 endfinally
1107             F1_END:
1108
1109             .try T_START to T1_END finally handler F1_START to F1_END
1110         }
1111
1112         .method public static int32 test_0_try_block_end_remove_if_useless () cil managed {
1113                 call void class Tests::try_block_end_remove_if_useless ()
1114                 ldc.i4.0
1115                 ret
1116         }
1117
1118    .method private static int32 test_0_regress_78629_switch_next_ins_target ()  cil managed
1119     {
1120         ldc.i4.0
1121         switch (target)
1122         target: ldstr "bar"
1123                 pop
1124                 ldc.i4.0
1125         ret
1126     }
1127 }