public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/106077] New: Invalid IPA-SRA with non-call exceptions
@ 2022-06-24 11:12 hubicka at gcc dot gnu.org
2022-06-24 13:07 ` [Bug ipa/106077] " hubicka at gcc dot gnu.org
2023-01-16 17:16 ` cvs-commit at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: hubicka at gcc dot gnu.org @ 2022-06-24 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106077
Bug ID: 106077
Summary: Invalid IPA-SRA with non-call exceptions
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Compiled with -O2 -fno-ipa-cp we make t() to trap instead of calling
non-call-exception from wrap
short e,f;
static __attribute__ ((noinline))
int a(int *b)
{
return *b;
}
static __attribute__ ((noinline))
__attribute__ ((optimize("non-call-exceptions")))
int wrap(int *b,int e, int f)
{
e/=f;
return a(b)+e;
}
int
t()
{
return wrap(0,1,0);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ipa/106077] Invalid IPA-SRA with non-call exceptions
2022-06-24 11:12 [Bug ipa/106077] New: Invalid IPA-SRA with non-call exceptions hubicka at gcc dot gnu.org
@ 2022-06-24 13:07 ` hubicka at gcc dot gnu.org
2023-01-16 17:16 ` cvs-commit at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: hubicka at gcc dot gnu.org @ 2022-06-24 13:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106077
--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Also note that the dominance check is written the wrong way, so it only passes
for first BB in the function
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 96b020fb2dd..6b2df2f3ff0 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -2403,8 +2403,8 @@ process_scan_results (cgraph_node *node, struct function
*fun,
pdoms_calculated = true;
}
if (dominated_by_p (CDI_POST_DOMINATORS,
- gimple_bb (call_stmt),
- single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun))))
+ single_succ (ENTRY_BLOCK_PTR_FOR_FN (fun))
+ gimple_bb (call_stmt)))
csum->m_arg_flow[argidx].safe_to_import_accesses = true;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ipa/106077] Invalid IPA-SRA with non-call exceptions
2022-06-24 11:12 [Bug ipa/106077] New: Invalid IPA-SRA with non-call exceptions hubicka at gcc dot gnu.org
2022-06-24 13:07 ` [Bug ipa/106077] " hubicka at gcc dot gnu.org
@ 2023-01-16 17:16 ` cvs-commit at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-16 17:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106077
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubicka@gcc.gnu.org>:
https://gcc.gnu.org/g:b1f30bf42d8d47228e52de998f3172b2f5dd7265
commit r13-5215-gb1f30bf42d8d47228e52de998f3172b2f5dd7265
Author: Jan Hubicka <jh@suse.cz>
Date: Mon Jan 16 18:14:45 2023 +0100
Fix wrong code issues with ipa-sra
Fix wrong code issues in ipa-sra where we are trying to prove that on every
execution of a given function a call to other function will happen. The
code
uses post dominators and makes a wrong query (which passes only for first
BB in
function). Hoever post-dominators are only valid if fake edges for every
possible reason for fuction execution to terminate are added.
Fixing this using postdominators is somewhat costy since one needs to walk
whole body and add a lot of fake edges. I ended up implementing a special
purpose function for this which is also useful in ipa-modref and other
places
that does similar analysis. One does not need to modify CFG to use it and
moreover for complex functions it usually stops on first unanalyzed
function
call and ends up being relatively cheap.
Bootstrapped/regtested x86_64-linux, plan to commit it shortly.
gcc/ChangeLog:
2023-01-16 Jan Hubicka <hubicka@ucw.cz>
PR ipa/106077
* ipa-modref.cc (modref_access_analysis::analyze): Use
find_always_executed_bbs.
* ipa-sra.cc (process_scan_results): Likewise.
* ipa-utils.cc (stmt_may_terminate_function_p): New function.
(find_always_executed_bbs): New function.
* ipa-utils.h (stmt_may_terminate_function_p): Declare.
(find_always_executed_bbs): Declare.
gcc/testsuite/ChangeLog:
2023-01-16 Jan Hubicka <hubicka@ucw.cz>
* g++.dg/tree-ssa/pr106077.C: New test.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-16 17:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 11:12 [Bug ipa/106077] New: Invalid IPA-SRA with non-call exceptions hubicka at gcc dot gnu.org
2022-06-24 13:07 ` [Bug ipa/106077] " hubicka at gcc dot gnu.org
2023-01-16 17:16 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).