diff options
author | Ben Elliston <bje@au.ibm.com> | 2008-04-05 03:50:18 +0000 |
---|---|---|
committer | Ben Elliston <bje@gcc.gnu.org> | 2008-04-05 14:50:18 +1100 |
commit | 23ef6d211fad08b1936e244c0bec5cc518aa33ac (patch) | |
tree | f13f58050775614ea8d63ab5cbedf12b98860b29 /gcc/tree-cfg.c | |
parent | c44b856a0b8071c190237763720ee07eaade0050 (diff) | |
download | gcc-23ef6d211fad08b1936e244c0bec5cc518aa33ac.zip gcc-23ef6d211fad08b1936e244c0bec5cc518aa33ac.tar.gz gcc-23ef6d211fad08b1936e244c0bec5cc518aa33ac.tar.bz2 |
tree-cfg.c (need_fake_edge_p): Return false for calls to builtins that return exactly once and do not throw.
* tree-cfg.c (need_fake_edge_p): Return false for calls to
builtins that return exactly once and do not throw. Cache call to
call_expr_flags.
From-SVN: r133929
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 7eea2e1..cf2001f 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6420,7 +6420,8 @@ tree_block_ends_with_condjump_p (const_basic_block bb) static bool need_fake_edge_p (tree t) { - tree call; + tree call, fndecl = NULL_TREE; + int call_flags; /* NORETURN and LONGJMP calls already have an edge to exit. CONST and PURE calls do not need one. @@ -6430,8 +6431,19 @@ need_fake_edge_p (tree t) the counter incrementation code from -fprofile-arcs leads to different results from -fbranch-probabilities. */ call = get_call_expr_in (t); - if (call - && !(call_expr_flags (call) & ECF_NORETURN)) + if (call) + { + fndecl = get_callee_fndecl (call); + call_flags = call_expr_flags (call); + } + + if (call && fndecl && DECL_BUILT_IN (fndecl) + && (call_flags & ECF_NOTHROW) + && !(call_flags & ECF_NORETURN) + && !(call_flags & ECF_RETURNS_TWICE)) + return false; + + if (call && !(call_flags & ECF_NORETURN)) return true; if (TREE_CODE (t) == ASM_EXPR |