Permalink
Browse files

In tests:

2008-12-08  Rodrigo Kumpera  <rkumpera@novell.com>

	* bug457574.il: New regression test.

	* Makefile.am: Test added.

	Backported from trunk r121174.

In mini:
2008-12-10  Rodrigo Kumpera  <rkumpera@novell.com>

	* ssa.c (fold_ins): branch opt can kill dummy switch ops so we can't
	expect that an OP_BR_REG will be there.

	* branch-opts.c (remove_block_if_useless): Use MONO_IS_BRANCH_OP instead of checking
	for the many branch ops. The original check miss OP_BR_REG.

	Fixes #457574.

	Backported from trunk r121173 and r121175


svn path=/branches/mono-2-2/mono/; revision=121210
  • Loading branch information...
1 parent 9fe47f5 commit dc330f3d57eb21109243f16df6ba7001a68bb963 @kumpera kumpera committed Dec 10, 2008
Showing with 123 additions and 9 deletions.
  1. +12 −0 mono/mini/ChangeLog
  2. +2 −6 mono/mini/branch-opts.c
  3. +3 −2 mono/mini/ssa2.c
  4. +8 −0 mono/tests/ChangeLog
  5. +2 −1 mono/tests/Makefile.am
  6. +96 −0 mono/tests/bug457574.il
View
@@ -1,3 +1,15 @@
+2008-12-10 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * ssa.c (fold_ins): branch opt can kill dummy switch ops so we can't
+ expect that an OP_BR_REG will be there.
+
+ * branch-opts.c (remove_block_if_useless): Use MONO_IS_BRANCH_OP instead of checking
+ for the many branch ops. The original check miss OP_BR_REG.
+
+ Fixes #457574.
+
+ Backported from trunk r121173 and r121175
+
2008-12-09 Zoltan Varga <vargaz@gmail.com>
Backport of r121150.
View
@@ -898,9 +898,7 @@ remove_block_if_useless (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *p
if ((previous_bb != cfg->bb_entry) &&
(previous_bb->region == bb->region) &&
((previous_bb->last_ins == NULL) ||
- ((previous_bb->last_ins->opcode != OP_BR) &&
- (! (MONO_IS_COND_BRANCH_OP (previous_bb->last_ins))) &&
- (previous_bb->last_ins->opcode != OP_SWITCH)))) {
+ (!MONO_IS_BRANCH_OP (previous_bb->last_ins)))) {
for (i = 0; i < previous_bb->out_count; i++) {
if (previous_bb->out_bb [i] == target_bb) {
MonoInst *jump;
@@ -1077,9 +1075,7 @@ mono_remove_critical_edges (MonoCompile *cfg)
/* If previous_bb "followed through" to bb, */
/* keep it linked with a OP_BR */
if ((previous_bb->last_ins == NULL) ||
- ((previous_bb->last_ins->opcode != OP_BR) &&
- (! (MONO_IS_COND_BRANCH_OP (previous_bb->last_ins))) &&
- (previous_bb->last_ins->opcode != OP_SWITCH))) {
+ !MONO_IS_BRANCH_OP (previous_bb->last_ins)) {
int i;
/* Make sure previous_bb really falls through bb */
for (i = 0; i < previous_bb->out_count; i++) {
View
@@ -1127,12 +1127,13 @@ fold_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst **carray
NULLIFY_INS (ins);
NULLIFY_INS (ins->next);
NULLIFY_INS (ins->next->next);
- NULLIFY_INS (ins->next->next->next);
+ if (ins->next->next->next)
+ NULLIFY_INS (ins->next->next->next);
return;
}
- if (ins->next->next->next->opcode != OP_BR_REG) {
+ if (!ins->next->next->next || ins->next->next->next->opcode != OP_BR_REG) {
/* A one-way switch which got optimized away */
if (G_UNLIKELY (cfg->verbose_level > 1)) {
printf ("\tNo cfold on ");
View
@@ -1,3 +1,11 @@
+2008-12-08 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * bug457574.il: New regression test.
+
+ * Makefile.am: Test added.
+
+ Backported from trunk r121174.
+
2008-12-03 Mark Probst <mark.probst@gmail.com>
Backport of r120589.
View
@@ -413,7 +413,8 @@ TEST_IL_SRC= \
generic-valuetype-newobj2.2.il \
generic-valuetype-newobj.2.il \
generic-constrained.2.il \
- bug-81466.il
+ bug-81466.il \
+ bug457574.il
# bug-318677.il
View
@@ -0,0 +1,96 @@
+.assembly extern mscorlib
+{
+.ver 2:0:0:0
+.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+}
+
+.assembly 'bug457574'
+{
+
+.hash algorithm 0x00008004
+.ver 0:0:0:0
+}
+.module repro.exe
+
+
+.class public auto ansi beforefieldinit bug457574_regression extends [mscorlib]System.Object
+{
+
+ .method public static hidebysig default bool test_01 () cil managed
+ {
+ .maxstack 6
+ .locals init (unsigned int32 V_0, unsigned int32 V_1)
+
+ ldc.i4.0
+ stloc.0
+
+ ldloc.0
+ switch (IL_0021, IL_0069)
+ br IL_0075
+
+IL_0021:
+ br IL_0069
+
+IL_0026:
+ ldloc.0
+ ldloc.1
+ ceq
+ brfalse IL_0051
+
+ br IL_0075
+
+IL_0051:
+ ldloc.1
+ stloc.0
+ br IL_0077
+
+IL_0069:
+ br IL_0026
+
+ ldc.i4.1
+ stloc.1
+
+IL_0075:
+ ldc.i4.0
+ ret
+
+IL_0077:
+ ldc.i4.1
+ ret
+ }
+
+ .method public static hidebysig default void test_02 () cil managed
+ {
+
+ .maxstack 8
+ .locals init (int32 V_0)
+
+ ldloc.0
+ switch(label_1, label_2)
+ br end
+ label_1:
+ br label_2
+ label_3:
+ nop
+ nop
+ br end
+ label_2:
+ br label_3
+ nop
+ nop
+ end:
+ ret
+ }
+
+.method public static hidebysig default void Main () cil managed
+{
+ .entrypoint
+ .maxstack 8
+
+ call bool bug457574_regression::test_01 ()
+ pop
+ call void bug457574_regression::test_02 ()
+ ret
+}
+
+}

0 comments on commit dc330f3

Please sign in to comment.