[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #32 from Jakub Jelinek --- For debug stmts when DCE isn't involved, we already seem to do the right thing, consider -O2 -g: __attribute__((noinline)) static void foo (int a) { int b = 2 * a; int c = 3 * a; a = a + 4; asm

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 Richard Biener changed: What|Removed |Added Priority|P1 |P2 --- Comment #31 from Richard Biener

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-20 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #30 from Martin Jambor --- Created attachment 48320 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48320=edit Todays WIP patch This is my todays (still very much) WIP patch. - It marks statements which should not be copied

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #29 from Jakub Jelinek --- (In reply to rguent...@suse.de from comment #28) > On Fri, 17 Apr 2020, jakub at gcc dot gnu.org wrote: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 > > > > --- Comment #26 from Jakub Jelinek

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-20 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #28 from rguenther at suse dot de --- On Fri, 17 Apr 2020, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 > > --- Comment #26 from Jakub Jelinek --- > For debug stmts, it would be best if we

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #27 from Jakub Jelinek --- Now, perhaps the analysis code could also detect which lhs are directly or indirectly needed by debug stmts and when doing this return NULL in remap_gimple_stmt, we could do something like (much simplified)

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #26 from Jakub Jelinek --- For debug stmts, it would be best if we could use those DEBUG D#Y s=> parm DEBUG var => D#Y added in if (param_body_adjs && MAY_HAVE_DEBUG_BIND_STMTS). Though, if we remove already

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #24 from rguenther at suse dot de --- On April 17, 2020 3:53:07 PM GMT+02:00, "jakub at gcc dot gnu.org" wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 > >--- Comment #23 from Jakub Jelinek --- >Instead of #c11 I meant:

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #25 from Martin Jambor --- (In reply to rguent...@suse.de from comment #21) > Btw, I'd much prefer to not first copy the stmts and then remove them. > Instead the DCE "analysis" can be done on the original IL and stmts > be "marked"

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #23 from Jakub Jelinek --- Instead of #c11 I meant: - else if ((is_gimple_assign (stmt) && !gimple_has_volatile_ops (stmt)) -|| gimple_code (stmt) == GIMPLE_PHI) + else if (flag_tree_dce +

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #22 from Martin Jambor --- (In reply to Jakub Jelinek from comment #18) > Comment on attachment 48302 [details] > Untested fix > > + /* IPA-SRA does not analyze other types of statements. */ > + gcc_unreachable ();

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #21 from rguenther at suse dot de --- On Fri, 17 Apr 2020, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 > > --- Comment #20 from Jakub Jelinek --- > Looking at tree-ssa-dce.c, it uses

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #20 from Jakub Jelinek --- Looking at tree-ssa-dce.c, it uses remove_phi_node rather than gsi_remove for PHIs. And for non-PHIs, it calls release_defs after gsi_remove.

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #19 from Richard Biener --- (In reply to Martin Jambor from comment #17) > Created attachment 48302 [details] > Untested fix > > I'm playing with this - only very mildly tested - fix. Ugh. I was thinking of altering the parameter

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #18 from Jakub Jelinek --- Comment on attachment 48302 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48302 Untested fix + /* IPA-SRA does not analyze other types of statements. */ + gcc_unreachable ();

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-17 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #17 from Martin Jambor --- Created attachment 48302 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48302=edit Untested fix I'm playing with this - only very mildly tested - fix.

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-04-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 Richard Biener changed: What|Removed |Added CC||hubicka at gcc dot gnu.org,

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-03-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #15 from Jakub Jelinek --- *** Bug 94178 has been marked as a duplicate of this bug. ***

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-23 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #14 from Martin Jambor --- Another option, which does not create an inter-pass dependency and does not clutter tree-inline any more, but which pessimizes IPA-SRA (put perhaps just alittle bit?), is making sure that the statements

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #13 from Martin Jambor --- The assumption is that DCE will eventually remove all gimple assignments with LHS which has no uses if gimple_has_volatile_ops returns false for them. I have had only a brief look at DCE today and it seems

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #12 from Jakub Jelinek --- Is that safe though? I mean, does ipa-sra use exactly the same logic as dce does? Say statements that could throw with non-call-exceptions and all that kinds of details. Wouldn't it be safer e.g. to

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #11 from Martin Jambor --- I'm going to test a patch that basically does the following (plus moving push_cfun a bit): diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c index 31de527d111..e18dc6958dc 100644 --- a/gcc/ipa-sra.c +++

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #10 from Martin Jambor --- Ah, -fno-tree-dce is specfied on the command line...

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #9 from Jakub Jelinek --- The options include -fno-tree-dce.

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 Martin Jambor changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #7 from Jakub Jelinek --- And with additiona -fno-early-inlining started with r10-3311-gff6686d2e5f797d6c6a36ad14a7084bc1dc350e4

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #6

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 --- Comment #5 from Richard Biener --- Hmm, no, IPA SRA thinks the parameter is unused (huh). Possibly -fno-ipa-cp isn't implemented "fully".

[Bug ipa/93385] [10 Regression] wrong code with u128 modulo at -O2 -fno-dce -fno-ipa-cp -fno-tree-dce

2020-01-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385 Richard Biener changed: What|Removed |Added Priority|P3 |P1 CC|