Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-ssa-dse.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
25 #include "ggc.h" | 25 #include "ggc.h" |
26 #include "tree.h" | 26 #include "tree.h" |
27 #include "tm_p.h" | 27 #include "tm_p.h" |
28 #include "basic-block.h" | 28 #include "basic-block.h" |
29 #include "timevar.h" | 29 #include "timevar.h" |
30 #include "diagnostic.h" | |
31 #include "gimple-pretty-print.h" | 30 #include "gimple-pretty-print.h" |
32 #include "tree-flow.h" | 31 #include "tree-flow.h" |
33 #include "tree-pass.h" | 32 #include "tree-pass.h" |
34 #include "tree-dump.h" | 33 #include "tree-dump.h" |
35 #include "domwalk.h" | 34 #include "domwalk.h" |
81 global bitmap of stores when we finish processing a block. */ | 80 global bitmap of stores when we finish processing a block. */ |
82 struct dse_block_local_data | 81 struct dse_block_local_data |
83 { | 82 { |
84 bitmap stores; | 83 bitmap stores; |
85 }; | 84 }; |
85 | |
86 /* Bitmap of blocks that have had EH statements cleaned. We should | |
87 remove their dead edges eventually. */ | |
88 static bitmap need_eh_cleanup; | |
86 | 89 |
87 static bool gate_dse (void); | 90 static bool gate_dse (void); |
88 static unsigned int tree_ssa_dse (void); | 91 static unsigned int tree_ssa_dse (void); |
89 static void dse_initialize_block_local_data (struct dom_walk_data *, | 92 static void dse_initialize_block_local_data (struct dom_walk_data *, |
90 basic_block, | 93 basic_block, |
300 /* If we have precisely one immediate use at this point and the | 303 /* If we have precisely one immediate use at this point and the |
301 stores are to the same memory location or there is a chain of | 304 stores are to the same memory location or there is a chain of |
302 virtual uses from stmt and the stmt which stores to that same | 305 virtual uses from stmt and the stmt which stores to that same |
303 memory location, then we may have found redundant store. */ | 306 memory location, then we may have found redundant store. */ |
304 if (bitmap_bit_p (dse_gd->stores, get_stmt_uid (use_stmt)) | 307 if (bitmap_bit_p (dse_gd->stores, get_stmt_uid (use_stmt)) |
305 && operand_equal_p (gimple_assign_lhs (stmt), | 308 && (operand_equal_p (gimple_assign_lhs (stmt), |
306 gimple_assign_lhs (use_stmt), 0)) | 309 gimple_assign_lhs (use_stmt), 0) |
310 || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))) | |
307 { | 311 { |
308 /* If use_stmt is or might be a nop assignment, e.g. for | 312 /* If use_stmt is or might be a nop assignment, e.g. for |
309 struct { ... } S a, b, *p; ... | 313 struct { ... } S a, b, *p; ... |
310 b = a; b = b; | 314 b = a; b = b; |
311 or | 315 or |
333 } | 337 } |
334 | 338 |
335 /* Then we need to fix the operand of the consuming stmt. */ | 339 /* Then we need to fix the operand of the consuming stmt. */ |
336 unlink_stmt_vdef (stmt); | 340 unlink_stmt_vdef (stmt); |
337 | 341 |
342 bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); | |
343 | |
338 /* Remove the dead store. */ | 344 /* Remove the dead store. */ |
339 gsi_remove (&gsi, true); | 345 gsi_remove (&gsi, true); |
340 | 346 |
341 /* And release any SSA_NAMEs set in this statement back to the | 347 /* And release any SSA_NAMEs set in this statement back to the |
342 SSA_NAME manager. */ | 348 SSA_NAME manager. */ |
399 tree_ssa_dse (void) | 405 tree_ssa_dse (void) |
400 { | 406 { |
401 struct dom_walk_data walk_data; | 407 struct dom_walk_data walk_data; |
402 struct dse_global_data dse_gd; | 408 struct dse_global_data dse_gd; |
403 | 409 |
410 need_eh_cleanup = BITMAP_ALLOC (NULL); | |
411 | |
404 renumber_gimple_stmt_uids (); | 412 renumber_gimple_stmt_uids (); |
405 | 413 |
406 /* We might consider making this a property of each pass so that it | 414 /* We might consider making this a property of each pass so that it |
407 can be [re]computed on an as-needed basis. Particularly since | 415 can be [re]computed on an as-needed basis. Particularly since |
408 this pass could be seen as an extension of DCE which needs post | 416 this pass could be seen as an extension of DCE which needs post |
433 fini_walk_dominator_tree (&walk_data); | 441 fini_walk_dominator_tree (&walk_data); |
434 | 442 |
435 /* Release the main bitmap. */ | 443 /* Release the main bitmap. */ |
436 BITMAP_FREE (dse_gd.stores); | 444 BITMAP_FREE (dse_gd.stores); |
437 | 445 |
446 /* Removal of stores may make some EH edges dead. Purge such edges from | |
447 the CFG as needed. */ | |
448 if (!bitmap_empty_p (need_eh_cleanup)) | |
449 { | |
450 gimple_purge_all_dead_eh_edges (need_eh_cleanup); | |
451 cleanup_tree_cfg (); | |
452 } | |
453 | |
454 BITMAP_FREE (need_eh_cleanup); | |
455 | |
438 /* For now, just wipe the post-dominator information. */ | 456 /* For now, just wipe the post-dominator information. */ |
439 free_dominance_info (CDI_POST_DOMINATORS); | 457 free_dominance_info (CDI_POST_DOMINATORS); |
440 return 0; | 458 return 0; |
441 } | 459 } |
442 | 460 |