This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR 19552
- From: Devang Patel <dpatel at apple dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 21 Feb 2005 17:38:58 -0800
- Subject: [PATCH] PR 19552
Skip all leading labels, not just first one, while inserting
statements to replace phi nodes. Bootstrapped and tested on
powerpc-darwin.
2005-02-21 Devang Patel <dpatel@apple.com>
PR 19552
* tree-if-conv.c (find_phie_replacement_condition,
replace_phie_with_cond_modify_expr): Insert after leading
labels.
* g++.dg/tree-ssa/pr19552.C: New test.
OK ?
-
Devang
Index: gcc/tree-if-conv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-if-conv.c,v
retrieving revision 2.27
diff -Idpatel.pbxuser -c -3 -p -r2.27 tree-if-conv.c
*** gcc/tree-if-conv.c 17 Feb 2005 16:19:41 -0000 2.27
--- gcc/tree-if-conv.c 22 Feb 2005 01:34:33 -0000
*************** find_phi_replacement_condition (basic_bl
*** 727,732 ****
--- 727,735 ----
tree new_stmt;
new_stmt = ifc_temp_var (TREE_TYPE (*cond), unshare_expr
(*cond));
+ /* Make sure we insert after any leading labels. */
+ if (TREE_CODE (bsi_stmt (*bsi)) == LABEL_EXPR)
+ *bsi = bsi_after_labels (bb);
bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT);
bsi_next (bsi);
*cond = TREE_OPERAND (new_stmt, 0);
*************** replace_phi_with_cond_modify_expr (tree
*** 796,801 ****
--- 799,808 ----
/* Set basic block and insert using iterator. */
set_bb_for_stmt (new_stmt, bb);
+ /* Make sure we insert after any leading labels. */
+ if (TREE_CODE (bsi_stmt (*bsi)) == LABEL_EXPR)
+ *bsi = bsi_after_labels (bb);
+
bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT);
bsi_next (bsi);
Index: gcc/testsuite/g++.dg/tree-ssa/pr19552.C
===================================================================
RCS file: gcc/testsuite/g++.dg/tree-ssa/pr19552.C
diff -N gcc/testsuite/g++.dg/tree-ssa/pr19552.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/g++.dg/tree-ssa/pr19552.C 22 Feb 2005 01:34:35
-0000
***************
*** 0 ****
--- 1,24 ----
+ /* PR 19552 */
+ /* { dg-compile } */
+ /* { dg-options "-ftree-vectorize -O2" } */
+
+ int i;
+
+ struct A
+ {
+ ~A() { ++i; }
+ };
+
+ struct B
+ {
+ A a;
+ };
+
+ void foo()
+ {
+ for (int i=0; i<2; ++i)
+ {
+ B *p;
+ if (p) p->~B();
+ }
+ }