[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Jambor changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #19 from Martin Jambor --- Fixed.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #18 from Martin Jambor --- Author: jamborm Date: Sat Jan 26 22:19:17 2019 New Revision: 268305 URL: https://gcc.gnu.org/viewcvs?rev=268305=gcc=rev Log: [PR ipa/88933] Careful CFG cleanup in IPA-CP function transformation 2019-01-26 Martin Jambor PR ipa/88933 * tree-inline.c: Include tree-cfgcleanup.h. (delete_unreachable_blocks_update_callgraph): Move... * tree-cfgcleanup.c (delete_unreachable_blocks_update_callgraph): ...here, make externally visible, make second argument bool, adjust all callers. * tree-cfgcleanup.c: Include cgraph.h. * tree-cfgcleanup.h (delete_unreachable_blocks_update_callgraph): Declare. * ipa-prop.c: Include tree-cfgcleanup.h. (ipcp_transform_function): Call delete_unreachable_blocks_update_callgraph instead of cleaning uo CFG. testsuite/ * gfortran.dg/gomp/pr88933.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/pr88933.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-prop.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-cfgcleanup.c trunk/gcc/tree-cfgcleanup.h trunk/gcc/tree-inline.c
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #17 from Martin Jambor --- OK, I did that too and proposed a patch in https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01525.html
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #16 from Jan Hubicka --- Looks OK. I would move delete_unreachable_blocks_update_callgraph to tree-cfgcleanup since it is no longer inliner specific. We probably also can sanity check that TODO_cfgcleanup is not done by ipa-transform passes. Honza
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Jambor changed: What|Removed |Added Attachment #45504|0 |1 is obsolete|| Attachment #45511|0 |1 is obsolete|| --- Comment #15 from Martin Jambor --- Created attachment 45512 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45512=edit Another untested fix This is what I'll be testing overnight (I have to run now). I hope I got it right.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #14 from Jan Hubicka --- > I'm currently testing this fix. Cleanup_cfg does other transformations that makes profile to change and statements move within bbs. Just use the unreachable block removal infrastructure we already have and keep it up to fixup_cfg to clean up remaining cases.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #13 from Martin Jambor --- (In reply to Jan Hubicka from comment #11) > Actually, looking at Martin's patch, I guess ipcp transfrom should do > the same as inliner - do not cleanup cfg but call > delete_unreachable_blocks_update_callgraph > and then go with SSA update via TODO. Oh, right, I forgot about potential clones. Let me try the above then.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #12 from Martin Jambor --- Created attachment 45511 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45511=edit Untested fix I'm currently testing this fix.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #11 from Jan Hubicka --- Actually, looking at Martin's patch, I guess ipcp transfrom should do the same as inliner - do not cleanup cfg but call delete_unreachable_blocks_update_callgraph and then go with SSA update via TODO. Honza
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #10 from Jan Hubicka --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 > > Martin Jambor changed: > >What|Removed |Added > > CC||jamborm at gcc dot gnu.org > > --- Comment #9 from Martin Jambor --- > (In reply to Martin Liška from comment #7) > > Created attachment 45504 [details] > > Untested patch candidate > > > > @Martin: Can you please take a look at the patch? > > I am afraid rebuilding call-graph edges would mean forgetting all > decisions to inline callees, because those are stored in > e->inline_failed, would it not? > > So it seems we have to somehow update the counts (or teach the > validator to ignore these mismatches during IPA funtion transformation > and pass manager to rebuild them after all transformations). Yep, while producing the clones it is up to tree clonning to keep cgraph up to date because edges can not be removed until inline decisions and other transformations are applied. The cfg cleanup there is mostly to prevent dead basic blocks which would later kill dominance calculation needed for SSA update. This is done by delete_unreachable_blocks_update_callgraph is there. Who calls merge_blocks? I am currently travelling but I can try to take a look tonight or tomorrow. Honza > > -- > You are receiving this mail because: > You are on the CC list for the bug.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Jambor changed: What|Removed |Added CC||jamborm at gcc dot gnu.org --- Comment #9 from Martin Jambor --- (In reply to Martin Liška from comment #7) > Created attachment 45504 [details] > Untested patch candidate > > @Martin: Can you please take a look at the patch? I am afraid rebuilding call-graph edges would mean forgetting all decisions to inline callees, because those are stored in e->inline_failed, would it not? So it seems we have to somehow update the counts (or teach the validator to ignore these mismatches during IPA funtion transformation and pass manager to rebuild them after all transformations).
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #8 from Martin Liška --- (In reply to Martin Liška from comment #7) > Created attachment 45504 [details] > Untested patch candidate > > @Martin: Can you please take a look at the patch? The patch survives regression tests and bootstraps fine.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #7 from Martin Liška --- Created attachment 45504 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45504=edit Untested patch candidate @Martin: Can you please take a look at the patch?
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek --- gimple_merge_blocks is called in between, which merges a bb with that 1073741825 with one with 445388109 count and nothing updates the call edge count after that adjustment.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Liška changed: What|Removed |Added CC||hubicka at gcc dot gnu.org, ||mjambor at suse dot cz --- Comment #5 from Martin Liška --- Reduced test-case for x86_64: $ !$omp parallel !$omp single call a !$omp end single !$omp end parallel contains subroutine b (c, d, e, f, g, h, i, j, k, m) character (*) c character d integer, dimension (m) :: e integer, dimension (m) :: f character g character h real, dimension (:, :, :) :: i double precision, dimension (:, :, :) :: j integer, dimension (:, :, :) :: k integer, dimension (m) :: l !$omp task firstprivate (k) firstprivate (l) !$omp end task c = '' end subroutine a character c character d integer, dimension (7) :: e integer, dimension (7) :: f character g character h real, dimension (5, 6, 7) :: i double precision, dimension (6, 6, 7) :: j integer, dimension (5, 7, 6) :: k call b (c, d, e, f, g, h, i, j, k, 7) end end $ ./xgcc -B. ~/Programming/testcases/god.f90 -c -std=legacy -O1 -fexceptions -fipa-cp -fnon-call-exceptions -fopenmp -fno-inline-functions-called-once b.2041.constprop.1/15 (b.constprop) @0x76c65e60 Type: function definition analyzed Visibility: artificial References: Referring: Availability: local First run: 0 Function flags: count: 1073741826 (estimated locally) body local Called by: a/0 (1073741825 (estimated locally),1.00 per call) (can throw external) Calls: __builtin_memset/12 (445388109 (estimated locally),0.41 per call) __builtin_free/14 (0,0.00 per call) during IPA pass: inline /home/marxin/Programming/testcases/god.f90:7:0: internal compiler error: verify_cgraph_node failed 0xaa864f cgraph_node::verify_node() ../../gcc/cgraph.c:3555 0xa95d17 symtab_node::verify() ../../gcc/symtab.c:1204 0x1110c0f optimize_inline_calls(tree_node*) ../../gcc/tree-inline.c:5086 0x1a2e4ee inline_transform(cgraph_node*) ../../gcc/ipa-inline-transform.c:682 0xf2aba1 execute_one_ipa_transform_pass ../../gcc/passes.c:2239 0xf2ad2b execute_all_ipa_transforms() ../../gcc/passes.c:2281 0xab5abe cgraph_node::expand() ../../gcc/cgraphunit.c:2132 0xab612d expand_all_functions ../../gcc/cgraphunit.c:2275 0xab6c92 symbol_table::compile() ../../gcc/cgraphunit.c:2624 0xab6f06 symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.c:2717 We first create a constprop, so that following edge is cloned: clonning: b/2->__builtin_free/14 # .MEM_19 = VDEF <.MEM_4(D)> __builtin_memset (c_18(D), 32, _c.14_1); and then after materialization we have following CFG: [local count: 1073741825]: if (1 != 0) goto ; [41.48%] else goto ; [58.52%] [local count: 445388109]: __builtin_memset (c_14(D), 32, _c.14_1); then the if condition is folded away and we end up with: [local count: 1073741825]: _5 = 5; _6 = 1; _7 = 5; _8 = 7; _9 = 1; _10 = 35; _11 = 6; _12 = 1; _13 = 7; __builtin_memset (c_14(D), 32, _c.14_1); return; and it's logical that count promotes from 445388109 -> 1073741825. Is it something known? I consider it's related to fact the call is a call to built-in. Honza, Martin, any ideas?
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Liška changed: What|Removed |Added Host||x86_64-pc-linux-gnu Known to fail||4.8.0 --- Comment #4 from Martin Liška --- Confirmed that, it's as old as GCC 4.8.0. I can reproduce that on x86_64.
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #3 from Arseny Solokha --- It does w/ -fchecking, but in a different way, so maybe these are really unrelated issues: https://gcc.godbolt.org/z/BbN9DX
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 --- Comment #2 from Martin Liška --- Started with r257233, where a new memcpy call builtin is introduced. Arseny, are you sure it fails also for GCC 6.* and GCC 7.* branches?
[Bug ipa/88933] ICE: verify_cgraph_node failed (Error: caller edge count does not match BB count)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88933 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2019-01-21 Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org Target Milestone|--- |9.0 Ever confirmed|0 |1 --- Comment #1 from Martin Liška --- Confirmed, let me take the PR.