diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2022-01-14 20:51:12 +0300 |
---|---|---|
committer | Alexander Monakov <amonakov@ispras.ru> | 2022-07-19 17:16:17 +0300 |
commit | 26cea5f108e0facdb080e385000bb141b086845f (patch) | |
tree | ff8fb6fd44e6609fcf03e6b331165cd38107246c /gcc/cfghooks.cc | |
parent | 76c3f0dc2f815e0e450642efd5348c3ab852e4d0 (diff) | |
download | gcc-26cea5f108e0facdb080e385000bb141b086845f.zip gcc-26cea5f108e0facdb080e385000bb141b086845f.tar.gz gcc-26cea5f108e0facdb080e385000bb141b086845f.tar.bz2 |
tree-cfg: do not duplicate returns_twice calls
A returns_twice call may have associated abnormal edges that correspond
to the "second return" from the call. If the call is duplicated, the
copies of those edges also need to be abnormal, but e.g. tracer does not
enforce that. Just prohibit the (unlikely to be useful) duplication.
gcc/ChangeLog:
* cfghooks.cc (duplicate_block): Expand comment.
* tree-cfg.cc (gimple_can_duplicate_bb_p): Reject blocks with
calls that may return twice.
Diffstat (limited to 'gcc/cfghooks.cc')
-rw-r--r-- | gcc/cfghooks.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cfghooks.cc b/gcc/cfghooks.cc index e435891..c6ac953 100644 --- a/gcc/cfghooks.cc +++ b/gcc/cfghooks.cc @@ -1086,9 +1086,16 @@ can_duplicate_block_p (const_basic_block bb) return cfg_hooks->can_duplicate_block_p (bb); } -/* Duplicates basic block BB and redirects edge E to it. Returns the - new basic block. The new basic block is placed after the basic block - AFTER. */ +/* Duplicate basic block BB, place it after AFTER (if non-null) and redirect + edge E to it (if non-null). Return the new basic block. + + If BB contains a returns_twice call, the caller is responsible for recreating + incoming abnormal edges corresponding to the "second return" for the copy. + gimple_can_duplicate_bb_p rejects such blocks, while RTL likes to live + dangerously. + + If BB has incoming abnormal edges for some other reason, their destinations + should be tied to label(s) of the original BB and not the copy. */ basic_block duplicate_block (basic_block bb, edge e, basic_block after, copy_bb_data *id) |