diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 05:19:05 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 05:19:05 +0000 |
commit | a6457fb8f13237911aa3625bbd27dcd903bf427d (patch) | |
tree | 76930a3238f5fc37694e789eedd62129d6fad7c8 /gcc/sese.c | |
parent | 3354e72ee606bb2aafe58a2404ee884fca64342b (diff) | |
download | gcc-a6457fb8f13237911aa3625bbd27dcd903bf427d.tar.gz |
2009-10-20 Sebastian Pop <sebastian.pop@amd.com>
* sese.c (get_vdef_before_sese): Handle GIMPLE_ASSIGN and GIMPLE_CALL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154613 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sese.c')
-rw-r--r-- | gcc/sese.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/gcc/sese.c b/gcc/sese.c index 2c38b24388c..917adbdf256 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -407,8 +407,8 @@ static tree get_vdef_before_sese (sese region, tree name, sbitmap visited) { unsigned i; - gimple def_stmt = SSA_NAME_DEF_STMT (name); - basic_block def_bb = gimple_bb (def_stmt); + gimple stmt = SSA_NAME_DEF_STMT (name); + basic_block def_bb = gimple_bb (stmt); if (!def_bb || !bb_in_sese_p (def_bb, region)) return name; @@ -418,18 +418,36 @@ get_vdef_before_sese (sese region, tree name, sbitmap visited) SET_BIT (visited, def_bb->index); - switch (gimple_code (def_stmt)) + switch (gimple_code (stmt)) { case GIMPLE_PHI: - for (i = 0; i < gimple_phi_num_args (def_stmt); i++) + for (i = 0; i < gimple_phi_num_args (stmt); i++) { - tree arg = gimple_phi_arg_def (def_stmt, i); - tree res = get_vdef_before_sese (region, arg, visited); + tree arg = gimple_phi_arg_def (stmt, i); + tree res; + + if (gimple_bb (SSA_NAME_DEF_STMT (arg)) + && def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (arg))->index) + continue; + + res = get_vdef_before_sese (region, arg, visited); if (res) return res; } return NULL_TREE; + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + { + use_operand_p use_p = gimple_vuse_op (stmt); + tree use = USE_FROM_PTR (use_p); + + if (def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (use))->index) + RESET_BIT (visited, def_bb->index); + + return get_vdef_before_sese (region, use, visited); + } + default: return NULL_TREE; } |