Commit baa09dc5 by Richard Biener Committed by Richard Biener

c-tree.h (enum c_declspec_il): New.

2019-03-14  Richard Biener  <rguenther@suse.de>

	c/
	* c-tree.h (enum c_declspec_il): New.
	(struct c_declspecs): Merge gimple_p and rtl_p into declspec_il
	enum bitfield.
	* c-parser.c (c_parser_declaration_or_fndef): Adjust accordingly.
	Pass start pass and declspec_il to c_parser_parse_gimple_body.
	(c_parser_declspecs): Adjust.
	* gimple-parser.c: Include cfg.h, cfghooks.h, cfganal.h, tree-cfg.h,
	gimple-iterator.h, cfgloop.h, tree-phinodes.h, tree-into-ssa.h
	and bitmap.h.
	(struct gimple_parser): New.
	(gimple_parser::push_edge): New method.
	(c_parser_gimple_parse_bb_spec): New helper.
	(c_parser_parse_gimple_body): Get start pass and IL specification.
	Initialize SSA and CFG.
	(c_parser_gimple_compound_statement): Handle CFG and SSA build.
	Build a gimple_parser parsing state and pass it along.
	(c_parser_gimple_statement): Change intermittend __PHI internal
	function argument for the edge.
	(c_parser_gimple_or_rtl_pass_list): Handle ssa, cfg flags.
	(c_parser_gimple_goto_stmt): Record edges to build.
	(c_parser_gimple_if_stmt): Likewise.
	* gimple-parser.h (c_parser_parse_gimple_body): Adjust.
	(c_parser_gimple_or_rtl_pass_list): Likewise.

	* gimple-pretty-print.c: Include cfgloop.h.
	(dump_gimple_phi): Adjust.
	(dump_gimple_bb_header): Dump loop header for GIMPLE.
	(pp_cfg_jump): Adjust.
	(dump_implicit_edges): Dump fallthru to next block for GIMPLE as well.
	* tree-cfg.c (build_gimple_cfg): Remove lower_phi_internal_fn call.
	(lower_phi_internal_fn): Remove.
	(verify_gimple_call): Remove IFN_PHI special-casing.
	(dump_function_to_file): Dump IL state.
	* tree-into-ssa.c (rewrite_add_phi_arguments): Revert changes
	done to deal with PHI nodes being present in non-SSA state.

	* gcc.dg/gimplefe-13.c: Adjust.
	* gcc.dg/gimplefe-14.c: Likewise.
	* gcc.dg/gimplefe-17.c: Likewise.
	* gcc.dg/gimplefe-18.c: Likewise.
	* gcc.dg/gimplefe-7.c: Likewise.
	* gcc.dg/torture/pr89595.c: Likewise.
	* gcc.dg/tree-ssa/cunroll-13.c: Likewise.
	* gcc.dg/tree-ssa/ivopt_mult_1g.c: Likewise.
	* gcc.dg/tree-ssa/ivopt_mult_2g.c: Likewise.
	* gcc.dg/tree-ssa/scev-3.c: Likewise.
	* gcc.dg/tree-ssa/scev-4.c: Likewise.
	* gcc.dg/tree-ssa/scev-5.c: Likewise.
	* gcc.dg/vect/vect-cond-arith-2.c: Likewise.
	* gcc.target/aarch64/sve/loop_add_6.c: Likewise.

From-SVN: r269682
parent 27814aed
2019-03-14 Richard Biener <rguenther@suse.de>
* gimple-pretty-print.c: Include cfgloop.h.
(dump_gimple_phi): Adjust.
(dump_gimple_bb_header): Dump loop header for GIMPLE.
(pp_cfg_jump): Adjust.
(dump_implicit_edges): Dump fallthru to next block for GIMPLE as well.
* tree-cfg.c (build_gimple_cfg): Remove lower_phi_internal_fn call.
(lower_phi_internal_fn): Remove.
(verify_gimple_call): Remove IFN_PHI special-casing.
(dump_function_to_file): Dump IL state.
* tree-into-ssa.c (rewrite_add_phi_arguments): Revert changes
done to deal with PHI nodes being present in non-SSA state.
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR ipa/89684
......
2019-03-14 Richard Biener <rguenther@suse.de>
* c-tree.h (enum c_declspec_il): New.
(struct c_declspecs): Merge gimple_p and rtl_p into declspec_il
enum bitfield.
* c-parser.c (c_parser_declaration_or_fndef): Adjust accordingly.
Pass start pass and declspec_il to c_parser_parse_gimple_body.
(c_parser_declspecs): Adjust.
* gimple-parser.c: Include cfg.h, cfghooks.h, cfganal.h, tree-cfg.h,
gimple-iterator.h, cfgloop.h, tree-phinodes.h, tree-into-ssa.h
and bitmap.h.
(struct gimple_parser): New.
(gimple_parser::push_edge): New method.
(c_parser_gimple_parse_bb_spec): New helper.
(c_parser_parse_gimple_body): Get start pass and IL specification.
Initialize SSA and CFG.
(c_parser_gimple_compound_statement): Handle CFG and SSA build.
Build a gimple_parser parsing state and pass it along.
(c_parser_gimple_statement): Change intermittend __PHI internal
function argument for the edge.
(c_parser_gimple_or_rtl_pass_list): Handle ssa, cfg flags.
(c_parser_gimple_goto_stmt): Record edges to build.
(c_parser_gimple_if_stmt): Likewise.
* gimple-parser.h (c_parser_parse_gimple_body): Adjust.
(c_parser_gimple_or_rtl_pass_list): Likewise.
2019-03-11 Martin Liska <mliska@suse.cz>
* c-decl.c (check_for_loop_decls): Wrap an option name
......
......@@ -2324,19 +2324,9 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
DECL_STRUCT_FUNCTION (current_function_decl)->function_start_locus
= c_parser_peek_token (parser)->location;
/* If the definition was marked with __GIMPLE then parse the
function body as GIMPLE. */
if (specs->gimple_p)
{
cfun->pass_startwith = specs->gimple_or_rtl_pass;
bool saved = in_late_binary_op;
in_late_binary_op = true;
c_parser_parse_gimple_body (parser);
in_late_binary_op = saved;
}
/* Similarly, if it was marked with __RTL, use the RTL parser now,
/* If the definition was marked with __RTL, use the RTL parser now,
consuming the function body. */
else if (specs->rtl_p)
if (specs->declspec_il == cdil_rtl)
{
c_parser_parse_rtl_body (parser, specs->gimple_or_rtl_pass);
......@@ -2350,6 +2340,16 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
finish_function ();
return;
}
/* If the definition was marked with __GIMPLE then parse the
function body as GIMPLE. */
else if (specs->declspec_il != cdil_none)
{
bool saved = in_late_binary_op;
in_late_binary_op = true;
c_parser_parse_gimple_body (parser, specs->gimple_or_rtl_pass,
specs->declspec_il);
in_late_binary_op = saved;
}
else
fnbody = c_parser_compound_statement (parser);
tree fndecl = current_function_decl;
......@@ -2372,8 +2372,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
add_stmt (fnbody);
finish_function ();
}
/* Get rid of the empty stmt list for GIMPLE. */
if (specs->gimple_p)
/* Get rid of the empty stmt list for GIMPLE/RTL. */
if (specs->declspec_il != cdil_none)
DECL_SAVED_TREE (fndecl) = NULL_TREE;
break;
......@@ -2882,15 +2882,15 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
if (! flag_gimple)
error_at (loc, "%<__GIMPLE%> only valid with %<-fgimple%>");
c_parser_consume_token (parser);
specs->gimple_p = true;
specs->declspec_il = cdil_gimple;
specs->locations[cdw_gimple] = loc;
specs->gimple_or_rtl_pass = c_parser_gimple_or_rtl_pass_list (parser);
c_parser_gimple_or_rtl_pass_list (parser, specs);
break;
case RID_RTL:
c_parser_consume_token (parser);
specs->rtl_p = true;
specs->declspec_il = cdil_rtl;
specs->locations[cdw_rtl] = loc;
specs->gimple_or_rtl_pass = c_parser_gimple_or_rtl_pass_list (parser);
c_parser_gimple_or_rtl_pass_list (parser, specs);
break;
default:
goto out;
......
......@@ -288,6 +288,14 @@ enum c_declspec_word {
enumerator. */
};
enum c_declspec_il {
cdil_none,
cdil_gimple, /* __GIMPLE */
cdil_gimple_cfg, /* __GIMPLE(cfg) */
cdil_gimple_ssa, /* __GIMPLE(ssa) */
cdil_rtl /* __RTL */
};
/* A sequence of declaration specifiers in C. When a new declaration
specifier is added, please update the enum c_declspec_word above
accordingly. */
......@@ -326,6 +334,7 @@ struct c_declspecs {
/* The kind of type specifier if one has been seen, ctsk_none
otherwise. */
ENUM_BITFIELD (c_typespec_kind) typespec_kind : 3;
ENUM_BITFIELD (c_declspec_il) declspec_il : 3;
/* Whether any expressions in typeof specifiers may appear in
constant expressions. */
BOOL_BITFIELD expr_const_operands : 1;
......@@ -381,10 +390,6 @@ struct c_declspecs {
/* Whether any alignment specifier (even with zero alignment) was
specified. */
BOOL_BITFIELD alignas_p : 1;
/* Whether any __GIMPLE specifier was specified. */
BOOL_BITFIELD gimple_p : 1;
/* Whether any __RTL specifier was specified. */
BOOL_BITFIELD rtl_p : 1;
/* The address space that the declaration belongs to. */
addr_space_t address_space;
};
......
......@@ -21,7 +21,8 @@ along with GCC; see the file COPYING3. If not see
#define GCC_GIMPLE_PARSER_H
/* Gimple parsing functions. */
extern void c_parser_parse_gimple_body (c_parser *);
extern char *c_parser_gimple_or_rtl_pass_list (c_parser *);
extern void c_parser_parse_gimple_body (c_parser *, char *,
enum c_declspec_il);
extern void c_parser_gimple_or_rtl_pass_list (c_parser *, c_declspecs *);
#endif
......@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
#include "cfgloop.h"
#define INDENT(SPACE) \
do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
......@@ -2221,18 +2222,11 @@ dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
{
if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
dump_location (buffer, gimple_phi_arg_location (phi, i));
basic_block src = gimple_phi_arg_edge (phi, i)->src;
if (flags & TDF_GIMPLE)
{
basic_block src = gimple_phi_arg_edge (phi, i)->src;
gimple *stmt = first_stmt (src);
if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
{
pp_string (buffer, "bb_");
pp_decimal_int (buffer, src->index);
}
else
dump_generic_node (buffer, gimple_label_label (as_a <glabel *> (stmt)), 0, flags,
false);
pp_string (buffer, "__BB");
pp_decimal_int (buffer, src->index);
pp_string (buffer, ": ");
}
dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
......@@ -2240,7 +2234,7 @@ dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
if (! (flags & TDF_GIMPLE))
{
pp_left_paren (buffer);
pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
pp_decimal_int (buffer, src->index);
pp_right_paren (buffer);
}
if (i < gimple_phi_num_args (phi) - 1)
......@@ -2706,7 +2700,12 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
else
{
if (flags & TDF_GIMPLE)
fprintf (outf, "%*sbb_%d:\n", indent, "", bb->index);
{
fprintf (outf, "%*s__BB(%d", indent, "", bb->index);
if (bb->loop_father->header == bb)
fprintf (outf, ",loop_header(%d)", bb->loop_father->num);
fprintf (outf, "):\n");
}
else
fprintf (outf, "%*s<bb %d> %s:\n",
indent, "", bb->index, dump_profile (bb->count));
......@@ -2759,7 +2758,7 @@ pp_cfg_jump (pretty_printer *buffer, edge e, dump_flags_t flags)
{
if (flags & TDF_GIMPLE)
{
pp_string (buffer, "goto bb_");
pp_string (buffer, "goto __BB");
pp_decimal_int (buffer, e->dest->index);
pp_semicolon (buffer);
}
......@@ -2812,7 +2811,7 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
goto to the dump. */
e = find_fallthru_edge (bb->succs);
if (e && e->dest != bb->next_bb)
if (e && (e->dest != bb->next_bb || (flags & TDF_GIMPLE)))
{
INDENT (indent);
......
2019-03-14 Richard Biener <rguenther@suse.de>
* gcc.dg/gimplefe-13.c: Adjust.
* gcc.dg/gimplefe-14.c: Likewise.
* gcc.dg/gimplefe-17.c: Likewise.
* gcc.dg/gimplefe-18.c: Likewise.
* gcc.dg/gimplefe-7.c: Likewise.
* gcc.dg/torture/pr89595.c: Likewise.
* gcc.dg/tree-ssa/cunroll-13.c: Likewise.
* gcc.dg/tree-ssa/ivopt_mult_1g.c: Likewise.
* gcc.dg/tree-ssa/ivopt_mult_2g.c: Likewise.
* gcc.dg/tree-ssa/scev-3.c: Likewise.
* gcc.dg/tree-ssa/scev-4.c: Likewise.
* gcc.dg/tree-ssa/scev-5.c: Likewise.
* gcc.dg/vect/vect-cond-arith-2.c: Likewise.
* gcc.target/aarch64/sve/loop_add_6.c: Likewise.
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR ipa/89684
......
/* { dg-do compile } */
/* { dg-options "-O -fgimple" } */
void __GIMPLE (startwith ("dse2")) foo ()
void __GIMPLE (ssa,startwith ("dse2")) foo ()
{
int a;
bb_2:
if (a > 4)
goto bb_3;
__BB(2):
if (a_5(D) > 4)
goto __BB3;
else
goto bb_4;
goto __BB4;
bb_3:
__BB(3):
a_2 = 10;
goto bb_5;
goto __BB5;
bb_4:
__BB(4):
a_3 = 20;
goto __BB5;
bb_5:
a_1 = __PHI (bb_3: a_2, bb_4: a_3);
__BB(5):
a_1 = __PHI (__BB3: a_2, __BB4: a_3);
a_4 = a_1 + 4;
return;
......
/* { dg-do run } */
/* { dg-options "-O -fgimple" } */
int __GIMPLE ()
int __GIMPLE (ssa)
main (int argc, char * * argv)
{
int a;
bb_2:
__BB(2):
/* Because of PR82114 we need to handle also 0 as base metal can have
argc == 0. */
switch (argc_2(D)) {default: L2; case 0: L0; case 1: L0; case 2: L1; }
__BB(3):
L0:
a_4 = 0;
goto bb_6;
goto __BB6;
__BB(4):
L1:
a_3 = 3;
goto bb_6;
goto __BB6;
__BB(5):
L2:
a_5 = -1;
goto __BB6;
bb_6:
a_1 = __PHI (L0: a_4, L1: a_3, L2: a_5);
__BB(6):
a_1 = __PHI (__BB3: a_4, __BB4: a_3, __BB5: a_5);
return a_1;
}
......
/* { dg-do compile } */
/* { dg-options "-fgimple -fdump-tree-ssa" } */
/* { dg-options "-fgimple -fdump-tree-fixup_cfg2" } */
int
__GIMPLE () *
__GIMPLE (ssa) *
foo ()
{
int _1;
int j;
int *b;
__BB(5):
_1 = 1;
bb1:
goto __BB2;
__BB(2):
if (_1)
goto bb3;
goto __BB4;
else
goto bb2;
goto __BB3;
bb2:
__BB(3):
b_2 = (int *)0;
goto __BB4;
bb3:
b_4 = __PHI (bb1: b_3(D), bb2: b_2);
__BB(4):
b_4 = __PHI (__BB2: b_3(D), __BB3: b_2);
return b_4;
}
/* { dg-final { scan-tree-dump-not "_1_" "ssa" } } */
/* { dg-final { scan-tree-dump-not "_1_" "fixup_cfg2" } } */
......@@ -2,23 +2,28 @@
/* { dg-options "-fgimple" } */
int
__GIMPLE () *
__GIMPLE (ssa) *
foo ()
{
int _1;
int j;
int *b;
__BB(2):
_1 = 1;
bb1:
goto __BB3;
__BB(3):
if (_1)
goto bb3;
goto __BB5;
else
goto bb2;
goto __BB4;
bb2:
__BB(4):
b_2 = (int *)0;
goto __BB5;
bb3:
b_4 = __PHI (bb1: &j, bb2: b_2);
__BB(5):
b_4 = __PHI (__BB3: &j, __BB4: b_2);
return b_4;
}
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
void __GIMPLE () foo ()
void __GIMPLE (ssa) foo ()
{
int a;
bb_2:
if (a > 4)
goto bb_3;
__BB(2):
if (a_5(D) > 4)
goto __BB3;
else
goto bb_4;
goto __BB4;
bb_3:
__BB(3):
a_2 = 10;
goto bb_5;
goto __BB5;
bb_4:
__BB(4):
a_3 = 20;
goto __BB5;
bb_5:
a_1 = __PHI (bb_3: a_2, bb_4: a_3);
__BB(5):
a_1 = __PHI (__BB3: a_2, __BB4: a_3);
a_4 = a_1 + 4;
return;
......
......@@ -2,33 +2,35 @@
/* { dg-additional-options "-fgimple" } */
int __attribute__((noipa))
__GIMPLE(startwith("dom")) bar(int cond, int val)
__GIMPLE(ssa,startwith("dom")) bar(int cond, int val)
{
int i;
__BB(3):
if (0 != 0)
goto bb_6;
goto __BB6;
else
goto bb_2;
goto __BB2;
bb_2:
__BB(2):
if (cond_5(D) != 0)
goto bb_4;
goto __BB4;
else
goto bb_5;
goto __BB5;
bb_4:
__BB(4):
i_6 = val_2(D);
i_1 = val_2(D) > 0 ? i_6 : 0;
goto __BB5;
bb_5:
i_3 = __PHI (bb_4: i_1, bb_2: 0);
__BB(5):
i_3 = __PHI (__BB4: i_1, __BB2: 0);
return i_3;
bb_6:
__BB(6):
i_4 = 1;
i_9 = 2;
goto bb_2;
goto __BB2;
}
int main()
......
......@@ -9,7 +9,7 @@ typedef int i32;
struct a {i32 a[8];i32 b;};
void __GIMPLE (startwith("fix_loops"))
void __GIMPLE (ssa,startwith("fix_loops"))
t (struct a * a)
{
i32 i;
......@@ -18,37 +18,37 @@ t (struct a * a)
i32 _9;
i32 _11;
bb_2:
__BB(2):
_11 = a_6(D)->a[0];
if (_11 != _Literal (i32) 0)
goto bb_6;
goto __BB6;
else
goto bb_3;
goto __BB3;
bb_3:
__BB(3):
return;
bb_4:
__BB(4):
_1 = _2 + _Literal (i32) 1;
a_6(D)->a[i_19] = _1;
i_8 = i_19 + _Literal (i32) 1;
if (i_8 <= _Literal (i32) 123455)
goto bb_5;
goto __BB5;
else
goto bb_3;
goto __BB3;
bb_5:
i_19 = __PHI (bb_6: _Literal (i32) 1, bb_4: i_8);
__BB(5):
i_19 = __PHI (__BB6: _Literal (i32) 1, __BB4: i_8);
_2 = a_6(D)->a[i_19];
if (_2 != _Literal (i32) 0)
goto bb_4;
goto __BB4;
else
goto bb_3;
goto __BB3;
bb_6:
__BB(6):
_9 = _11 + _Literal (i32) 1;
a_6(D)->a[0] = _9;
goto bb_5;
goto __BB5;
}
/* This testcase relies on the fact that we do not eliminate the redundant test
......
......@@ -3,7 +3,7 @@
/* The test 'if (p2 > p_limit2)' can be replaced, so iv p2 can be
* eliminated. */
long int __GIMPLE (startwith("fix_loops"))
long int __GIMPLE (ssa,startwith("fix_loops"))
foo (long int * p, long int * p2, int N1, int N2)
{
long int s;
......@@ -15,7 +15,7 @@ foo (long int * p, long int * p2, int N1, int N2)
long unsigned int _4;
long int _5;
bb_2:
__BB(2):
_1 = (long unsigned int) N1_10(D);
_2 = _1 * 8ul;
p_limit_12 = p_11(D) + _2;
......@@ -23,59 +23,60 @@ foo (long int * p, long int * p2, int N1, int N2)
_4 = _3 * 8ul;
p_limit2_15 = p2_14(D) + _4;
if (p_11(D) <= p_limit_12)
goto bb_3;
goto __BB3;
else
goto bb_13;
goto __BB13;
bb_13:
__BB(13):
goto __BB9;
bb_9:
goto bb_6;
__BB(9):
goto __BB6;
bb_3:
__BB(3):
p_20 = p_11(D) + 8ul;
p2_23 = p2_14(D) + 8ul;
if (p_limit2_15 < p2_23)
goto bb_14;
goto __BB14;
else
goto bb_7;
goto __BB7;
bb_14:
goto bb_9;
__BB(14):
goto __BB9;
bb_7:
goto bb_5;
__BB(7):
goto __BB5;
bb_4:
__BB(4):
p_16 = p_26 + 8ul;
p2_17 = p2_27 + 8ul;
if (p_limit2_15 < p2_17)
goto bb_11;
goto __BB11;
else
goto bb_8;
goto __BB8;
bb_11:
goto bb_6;
__BB(11):
goto __BB6;
bb_8:
;
__BB(8):
goto __BB5;
bb_5:
s_24 = __PHI (bb_7: 0l, bb_8: s_19);
p_26 = __PHI (bb_7: p_20, bb_8: p_16);
p2_27 = __PHI (bb_7: p2_23, bb_8: p2_17);
__BB(5):
s_24 = __PHI (__BB7: 0l, __BB8: s_19);
p_26 = __PHI (__BB7: p_20, __BB8: p_16);
p2_27 = __PHI (__BB7: p2_23, __BB8: p2_17);
_5 = __MEM <long int> (p_26);
s_19 = _5 + s_24;
if (p_limit_12 >= p_26)
goto bb_4;
goto __BB4;
else
goto bb_12;
goto __BB12;
bb_12:
;
__BB(12):
goto __BB6;
bb_6:
s_25 = __PHI (bb_12: s_19, bb_11: s_19, bb_9: 0l);
__BB(6):
s_25 = __PHI (__BB12: s_19, __BB11: s_19, __BB9: 0l);
return s_25;
}
......
......@@ -3,7 +3,7 @@
/* Exit tests 'i < N1' and 'p2 > p_limit2' can be replaced, so
* two ivs i and p2 can be eliminate. */
long int __GIMPLE (startwith("fix_loops"))
long int __GIMPLE (ssa,startwith("fix_loops"))
foo (long int * p, long int * p2, int N1, int N2)
{
long int s;
......@@ -13,66 +13,67 @@ foo (long int * p, long int * p2, int N1, int N2)
long unsigned int _2;
long int _3;
bb_2:
__BB(2):
_1 = (long unsigned int) N2_9(D);
_2 = _1 * 8ul;
p_limit2_11 = p2_10(D) + _2;
if (N1_13(D) > 0)
goto bb_3;
goto __BB3;
else
goto bb_13;
goto __BB13;
bb_13:
__BB(13):
goto __BB9;
bb_9:
goto bb_6;
__BB(9):
goto __BB6;
bb_3:
__BB(3):
p_22 = p_12(D) + 8ul;
p2_23 = p2_10(D) + 8ul;
if (p_limit2_11 < p2_23)
goto bb_14;
goto __BB14;
else
goto bb_7;
goto __BB7;
bb_14:
goto bb_9;
__BB(14):
goto __BB9;
bb_7:
goto bb_5;
__BB(7):
goto __BB5;
bb_4:
__BB(4):
p_14 = p_27 + 8ul;
p2_15 = p2_28 + 8ul;
i_16 = i_29 + 1;
if (p_limit2_11 < p2_15)
goto bb_11;
goto __BB11;
else
goto bb_8;
goto __BB8;
bb_11:
goto bb_6;
__BB(11):
goto __BB6;
bb_8:
;
__BB(8):
goto __BB5;
bb_5:
s_25 = __PHI (bb_7: 0l, bb_8: s_18);
p_27 = __PHI (bb_7: p_22, bb_8: p_14);
p2_28 = __PHI (bb_7: p2_23, bb_8: p2_15);
i_29 = __PHI (bb_7: 1, bb_8: i_16);
__BB(5):
s_25 = __PHI (__BB7: 0l, __BB8: s_18);
p_27 = __PHI (__BB7: p_22, __BB8: p_14);
p2_28 = __PHI (__BB7: p2_23, __BB8: p2_15);
i_29 = __PHI (__BB7: 1, __BB8: i_16);
_3 = __MEM <long int> (p_27);
s_18 = _3 + s_25;
if (N1_13(D) > i_29)
goto bb_4;
goto __BB4;
else
goto bb_12;
goto __BB12;
bb_12:
;
__BB(12):
goto __BB6;
bb_6:
s_26 = __PHI (bb_12: s_18, bb_11: s_18, bb_9: 0l);
__BB(6):
s_26 = __PHI (__BB12: s_18, __BB11: s_18, __BB9: 0l);
return s_26;
}
......
......@@ -4,39 +4,39 @@
int *a_p;
int a[1000];
void __GIMPLE (startwith ("loop"))
void __GIMPLE (ssa,startwith ("loop"))
f (int k)
{
int i;
int * _1;
bb_2:
__BB(2):
i_5 = k_4(D);
if (i_5 <= 999)
goto bb_4;
goto __BB4;
else
goto bb_3;
goto __BB3;
bb_3:
__BB(3):
return;
bb_4:
;
__BB(4):
goto __BB5;
bb_5:
i_12 = __PHI (bb_6: i_9, bb_4: i_5);
__BB(5):
i_12 = __PHI (__BB6: i_9, __BB4: i_5);
_1 = &a[i_12];
a_p = _1;
__MEM <int[1000]> ((int *)&a)[i_12] = 100;
i_9 = i_5 + i_12;
if (i_9 <= 999)
goto bb_6;
goto __BB6;
else
goto bb_3;
goto __BB3;
bb_6:
__BB(6):
;
goto bb_5;
goto __BB5;
}
......
......@@ -9,39 +9,39 @@ typedef struct {
int *a_p;
S a[1000];
void __GIMPLE (startwith ("loop"))
void __GIMPLE (ssa, startwith ("loop"))
f (int k)
{
int i;
int * _1;
bb_2:
__BB(2):
i_5 = k_4(D);
if (i_5 <= 999)
goto bb_4;
goto __BB4;
else
goto bb_3;
goto __BB3;
bb_3:
__BB(3):
return;
bb_4:
;
__BB(4):
goto __BB5;
bb_5:
i_12 = __PHI (bb_6: i_9, bb_4: i_5);
__BB(5):
i_12 = __PHI (__BB6: i_9, __BB4: i_5);
_1 = &a[i_12].y;
a_p = _1;
__MEM <S[1000]> ((int *)&a)[i_12].y = 100;
i_9 = i_5 + i_12;
if (i_9 <= 999)
goto bb_6;
goto __BB6;
else
goto bb_3;
goto __BB3;
bb_6:
__BB(6):
;
goto bb_5;
goto __BB5;
}
......
......@@ -4,39 +4,39 @@
int *a_p;
int a[1000];
void __GIMPLE (startwith ("loop"))
void __GIMPLE (ssa,startwith ("loop"))
f (int k)
{
long long int i;
int * _1;
bb_2:
__BB(2):
i_5 = (long long int) k_4(D);
if (i_5 <= 999ll)
goto bb_4;
goto __BB4;
else
goto bb_3;
goto __BB3;
bb_3:
__BB(3):
return;
bb_4:
;
__BB(4):
goto __BB5;
bb_5:
i_12 = __PHI (bb_6: i_9, bb_4: i_5);
__BB(5):
i_12 = __PHI (__BB6: i_9, __BB4: i_5);
_1 = &a[i_12];
a_p = _1;
__MEM <int[1000]> ((int *)&a)[i_12] = 100;
i_9 = i_5 + i_12;
if (i_9 <= 999ll)
goto bb_6;
goto __BB6;
else
goto bb_3;
goto __BB3;
bb_6:
__BB(6):
;
goto bb_5;
goto __BB5;
}
......
/* { dg-do compile } */
/* { dg-additional-options "-fgimple -fdump-tree-optimized -ffast-math" } */
double __GIMPLE (startwith("loop"))
double __GIMPLE (ssa, startwith("loop"))
neg_xi (double *x)
{
int i;
......@@ -13,13 +13,13 @@ neg_xi (double *x)
double res;
unsigned int ivtmp;
bb_1:
goto bb_2;
__BB(5):
goto __BB2;
bb_2:
res_1 = __PHI (bb_1: 0.0, bb_3: res_2);
i_4 = __PHI (bb_1: 0, bb_3: i_5);
ivtmp_6 = __PHI (bb_1: 100U, bb_3: ivtmp_7);
__BB(2):
res_1 = __PHI (__BB5: 0.0, __BB3: res_2);
i_4 = __PHI (__BB5: 0, __BB3: i_5);
ivtmp_6 = __PHI (__BB5: 100U, __BB3: ivtmp_7);
index = (long unsigned int) i_4;
offset = index * 8UL;
xi_ptr = x_8(D) + offset;
......@@ -29,15 +29,15 @@ neg_xi (double *x)
i_5 = i_4 + 1;
ivtmp_7 = ivtmp_6 - 1U;
if (ivtmp_7 != 0U)
goto bb_3;
goto __BB3;
else
goto bb_4;
goto __BB4;
bb_3:
goto bb_2;
__BB(3):
goto __BB2;
bb_4:
res_3 = __PHI (bb_2: res_2);
__BB(4):
res_3 = __PHI (__BB2: res_2);
return res_3;
}
......
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-vectorize -fgimple -ffast-math" } */
double __GIMPLE (startwith("loop"))
double __GIMPLE (ssa, startwith("loop"))
neg_xi (double *x)
{
int i;
......@@ -13,13 +13,13 @@ neg_xi (double *x)
double res;
unsigned int ivtmp;
bb_1:
goto bb_2;
__BB(5):
goto __BB2;
bb_2:
res_1 = __PHI (bb_1: 0.0, bb_3: res_2);
i_4 = __PHI (bb_1: 0, bb_3: i_5);
ivtmp_6 = __PHI (bb_1: 100U, bb_3: ivtmp_7);
__BB(2):
res_1 = __PHI (__BB5: 0.0, __BB3: res_2);
i_4 = __PHI (__BB5: 0, __BB3: i_5);
ivtmp_6 = __PHI (__BB5: 100U, __BB3: ivtmp_7);
index = (long unsigned int) i_4;
offset = index * 8UL;
xi_ptr = x_8(D) + offset;
......@@ -29,15 +29,15 @@ neg_xi (double *x)
i_5 = i_4 + 1;
ivtmp_7 = ivtmp_6 - 1U;
if (ivtmp_7 != 0U)
goto bb_3;
goto __BB3;
else
goto bb_4;
goto __BB4;
bb_3:
goto bb_2;
__BB(3):
goto __BB2;
bb_4:
res_3 = __PHI (bb_2: res_2);
__BB(4):
res_3 = __PHI (__BB2: res_2);
return res_3;
}
......
......@@ -171,7 +171,6 @@ static bool gimple_can_merge_blocks_p (basic_block, basic_block);
static void remove_bb (basic_block);
static edge find_taken_edge_computed_goto (basic_block, tree);
static edge find_taken_edge_cond_expr (const gcond *, tree);
static void lower_phi_internal_fn ();
void
init_empty_tree_cfg_for_function (struct function *fn)
......@@ -246,7 +245,6 @@ build_gimple_cfg (gimple_seq seq)
discriminator_per_locus = new hash_table<locus_discrim_hasher> (13);
make_edges ();
assign_discriminators ();
lower_phi_internal_fn ();
cleanup_dead_labels ();
delete discriminator_per_locus;
discriminator_per_locus = NULL;
......@@ -359,47 +357,6 @@ replace_loop_annotate (void)
}
}
/* Lower internal PHI function from GIMPLE FE. */
static void
lower_phi_internal_fn ()
{
basic_block bb, pred = NULL;
gimple_stmt_iterator gsi;
tree lhs;
gphi *phi_node;
gimple *stmt;
/* After edge creation, handle __PHI function from GIMPLE FE. */
FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi);)
{
stmt = gsi_stmt (gsi);
if (! gimple_call_internal_p (stmt, IFN_PHI))
break;
lhs = gimple_call_lhs (stmt);
phi_node = create_phi_node (lhs, bb);
/* Add arguments to the PHI node. */
for (unsigned i = 0; i < gimple_call_num_args (stmt); ++i)
{
tree arg = gimple_call_arg (stmt, i);
if (TREE_CODE (arg) == LABEL_DECL)
pred = label_to_block (cfun, arg);
else
{
edge e = find_edge (pred, bb);
add_phi_arg (phi_node, arg, e, UNKNOWN_LOCATION);
}
}
gsi_remove (&gsi, true);
}
}
}
static unsigned int
execute_build_cfg (void)
{
......@@ -3337,11 +3294,6 @@ verify_gimple_call (gcall *stmt)
debug_generic_stmt (fn);
return true;
}
/* FIXME : for passing label as arg in internal fn PHI from GIMPLE FE*/
else if (gimple_call_internal_fn (stmt) == IFN_PHI)
{
return false;
}
}
else
{
......@@ -7922,7 +7874,11 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
{
print_generic_expr (file, TREE_TYPE (TREE_TYPE (fndecl)),
dump_flags | TDF_SLIM);
fprintf (file, " __GIMPLE ()\n%s (", function_name (fun));
fprintf (file, " __GIMPLE (%s)\n%s (",
(fun->curr_properties & PROP_ssa) ? "ssa"
: (fun->curr_properties & PROP_cfg) ? "cfg"
: "",
function_name (fun));
}
else
fprintf (file, "%s %s(", function_name (fun), tmclone ? "[tm-clone] " : "");
......
......@@ -1436,20 +1436,12 @@ rewrite_add_phi_arguments (basic_block bb)
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
gsi_next (&gsi))
{
tree currdef, res, argvar;
tree currdef, res;
location_t loc;
phi = gsi.phi ();
res = gimple_phi_result (phi);
/* If we have pre-existing PHI (via the GIMPLE FE) its args may
be different vars than existing vars and they may be constants
as well. Note the following supports partial SSA for PHI args. */
argvar = gimple_phi_arg_def (phi, e->dest_idx);
if (argvar && ! DECL_P (argvar))
continue;
if (!argvar)
argvar = SSA_NAME_VAR (res);
currdef = get_reaching_def (argvar);
currdef = get_reaching_def (SSA_NAME_VAR (res));
/* Virtual operand PHI args do not need a location. */
if (virtual_operand_p (res))
loc = UNKNOWN_LOCATION;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment