From e472781227253bf87e273512026256fb563b1646 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Mon, 17 Nov 2014 13:52:37 +0000 Subject: tree-chkp-opt.c (chkp_get_nobnd_fndecl): New. gcc/ * tree-chkp-opt.c (chkp_get_nobnd_fndecl): New. (chkp_get_nochk_fndecl): New. (chkp_optimize_string_function_calls): New. (chkp_opt_execute): Call chkp_optimize_string_function_calls. * tree-cfg.h (insert_cond_bb): New. * tree-cfg.c (insert_cond_bb): New. gcc/testsuite/ * gcc.target/i386/chkp-stropt-1.c: New. * gcc.target/i386/chkp-stropt-2.c: New. * gcc.target/i386/chkp-stropt-3.c: New. * gcc.target/i386/chkp-stropt-4.c: New. * gcc.target/i386/chkp-stropt-5.c: New. * gcc.target/i386/chkp-stropt-6.c: New. * gcc.target/i386/chkp-stropt-7.c: New. * gcc.target/i386/chkp-stropt-8.c: New. * gcc.target/i386/chkp-stropt-9.c: New. * gcc.target/i386/chkp-stropt-10.c: New. * gcc.target/i386/chkp-stropt-11.c: New. * gcc.target/i386/chkp-stropt-12.c: New. * gcc.target/i386/chkp-stropt-13.c: New. * gcc.target/i386/chkp-stropt-14.c: New. * gcc.target/i386/chkp-stropt-15.c: New. * gcc.target/i386/chkp-stropt-16.c: New. From-SVN: r217656 --- gcc/tree-cfg.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gcc/tree-cfg.c') diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index ae7734c..9dd8961 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -8178,6 +8178,46 @@ make_pass_split_crit_edges (gcc::context *ctxt) } +/* Insert COND expression which is GIMPLE_COND after STMT + in basic block BB with appropriate basic block split + and creation of a new conditionally executed basic block. + Return created basic block. */ +basic_block +insert_cond_bb (basic_block bb, gimple stmt, gimple cond) +{ + edge fall = split_block (bb, stmt); + gimple_stmt_iterator iter = gsi_last_bb (bb); + basic_block new_bb; + + /* Insert cond statement. */ + gcc_assert (gimple_code (cond) == GIMPLE_COND); + if (gsi_end_p (iter)) + gsi_insert_before (&iter, cond, GSI_CONTINUE_LINKING); + else + gsi_insert_after (&iter, cond, GSI_CONTINUE_LINKING); + + /* Create conditionally executed block. */ + new_bb = create_empty_bb (bb); + make_edge (bb, new_bb, EDGE_TRUE_VALUE); + make_single_succ_edge (new_bb, fall->dest, EDGE_FALLTHRU); + + /* Fix edge for split bb. */ + fall->flags = EDGE_FALSE_VALUE; + + /* Update dominance info. */ + if (dom_info_available_p (CDI_DOMINATORS)) + { + set_immediate_dominator (CDI_DOMINATORS, new_bb, bb); + set_immediate_dominator (CDI_DOMINATORS, fall->dest, bb); + } + + /* Update loop info. */ + if (current_loops) + add_bb_to_loop (new_bb, bb->loop_father); + + return new_bb; +} + /* Build a ternary operation and gimplify it. Emit code before GSI. Return the gimple_val holding the result. */ -- cgit v1.1