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/tree-cfg.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/tree-cfg.cc')
-rw-r--r-- | gcc/tree-cfg.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index bfcb142..a365aad 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -6313,12 +6313,15 @@ gimple_can_duplicate_bb_p (const_basic_block bb) { gimple *g = gsi_stmt (gsi); - /* An IFN_GOMP_SIMT_ENTER_ALLOC/IFN_GOMP_SIMT_EXIT call must be + /* Prohibit duplication of returns_twice calls, otherwise associated + abnormal edges also need to be duplicated properly. + An IFN_GOMP_SIMT_ENTER_ALLOC/IFN_GOMP_SIMT_EXIT call must be duplicated as part of its group, or not at all. The IFN_GOMP_SIMT_VOTE_ANY and IFN_GOMP_SIMT_XCHG_* are part of such a group, so the same holds there. */ if (is_gimple_call (g) - && (gimple_call_internal_p (g, IFN_GOMP_SIMT_ENTER_ALLOC) + && (gimple_call_flags (g) & ECF_RETURNS_TWICE + || gimple_call_internal_p (g, IFN_GOMP_SIMT_ENTER_ALLOC) || gimple_call_internal_p (g, IFN_GOMP_SIMT_EXIT) || gimple_call_internal_p (g, IFN_GOMP_SIMT_VOTE_ANY) || gimple_call_internal_p (g, IFN_GOMP_SIMT_XCHG_BFLY) |