Command line: $ gcc -Os -fgraphite-identity testcase.c Compiler output: $ gcc -Os -fgraphite-identity testcase.c testcase.c: In function 'foo': testcase.c:2:1: internal compiler error: in create_linear_expr_from_tree, at graphite-sese-to-poly.c:1210 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r163261 - crash r162940 - OK
Created attachment 21489 [details] reduced testcase (from gcc.c-torture/execute/990513-1.c) $ gcc -Os -fgraphite-identity pr45297.c pr45297.c: In function 'foo': pr45297.c:2:1: internal compiler error: in create_linear_expr_from_tree, at graphite-sese-to-poly.c:1210
This also appears to be causing the testsuite failures of... FAIL: gcc.c-torture/execute/921013-1.c compilation, -O2 (internal compiler error) FAIL: gcc.c-torture/execute/921013-1.c compilation, -O2 -flto (internal compiler error) FAIL: gcc.c-torture/execute/921013-1.c compilation, -O2 -fwhopr (internal compiler error) at -m32 and... FAIL: gcc.c-torture/execute/990513-1.c compilation, -Os (internal compiler error) at both -m32 and -m64.
(In reply to comment #2) the above was with use of... Index: opts.c =================================================================== --- opts.c (revision 162966) +++ opts.c (working copy) @@ -781,6 +781,9 @@ /* -O2 optimizations. */ opt2 = (optimize >= 2); +#ifdef HAVE_cloog + flag_graphite_identity = opt2; +#endif flag_inline_small_functions = opt2; flag_indirect_inlining = opt2; flag_partial_inlining = opt2;
Mine.
Author: spop Date: Mon Nov 22 23:17:25 2010 New Revision: 167060 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167060 Log: Postpone the rewrite out of SSA to the end of the translation to polyhedral representation. 2010-11-22 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/45297 * graphite-poly.c (new_poly_bb): Returns a poly_bb_p. Do not take the reduction bool in parameter. Clear PBB_IS_REDUCTION. Set GBB_PBB. * graphite-poly.h (new_poly_bb): Update declaration. (gbb_from_bb): Moved here... (pbb_from_bb): New. * graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node): Removed. (graphite_stmt_p): Removed. (try_generate_gimple_bb): Returns a gimple_bb_p. Do not pass in sbitmap reductions. Always build a gimple_bb_p. Do not call new_poly_bb. (build_scop_bbs_1): Do not pass in sbitmap reductions. (build_scop_bbs): Same. (gbb_from_bb): ... from here. (add_conditions_to_constraints): Moved up. (analyze_drs): New. (build_scop_drs): Call analyze_drs. Remove all the PBBs that do not contain data references. (new_pbb_from_pbb): New. (insert_out_of_ssa_copy_on_edge): Call new_pbb_from_pbb after a block is split. (rewrite_close_phi_out_of_ssa): Update call to insert_out_of_ssa_copy_on_edge. (rewrite_reductions_out_of_ssa): Now static. (rewrite_cross_bb_scalar_deps_out_of_ssa): Same. (split_pbb): New. (split_reduction_stmt): Call split_pbb. (translate_scalar_reduction_to_array): Pass in the scop, do not pass in the sbitmap reductions. (rewrite_commutative_reductions_out_of_ssa_close_phi): Same. (rewrite_commutative_reductions_out_of_ssa_loop): Same. (rewrite_commutative_reductions_out_of_ssa): Same. (build_poly_scop): Call build_scop_bbs, rewrite_commutative_reductions_out_of_ssa, rewrite_reductions_out_of_ssa, and rewrite_cross_bb_scalar_deps_out_of_ssa. Move build_scop_drs before scop_to_lst. * graphite-sese-to-poly.h (rewrite_commutative_reductions_out_of_ssa): Removed declaration. (rewrite_reductions_out_of_ssa): Same. (rewrite_cross_bb_scalar_deps_out_of_ssa): Same. (build_scop_bbs): Same. * graphite.c (graphite_transform_loops): Do not initialize reductions. Do not call build_scop_bbs, rewrite_commutative_reductions_out_of_ssa, rewrite_reductions_out_of_ssa, and rewrite_cross_bb_scalar_deps_out_of_ssa. * sese.h (struct gimple_bb): Add field pbb. (GBB_PBB): New. * gcc.dg/graphite/pr45297.c: New. Added: branches/graphite/gcc/testsuite/gcc.dg/graphite/pr45297.c Modified: branches/graphite/gcc/ChangeLog.graphite branches/graphite/gcc/graphite-poly.c branches/graphite/gcc/graphite-poly.h branches/graphite/gcc/graphite-sese-to-poly.c branches/graphite/gcc/graphite-sese-to-poly.h branches/graphite/gcc/graphite.c branches/graphite/gcc/sese.h
Author: spop Date: Wed Dec 1 17:25:10 2010 New Revision: 167348 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167348 Log: Postpone the rewrite out of SSA to the end of the translation to polyhedral representation. 2010-11-22 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/45297 * graphite-poly.c (new_poly_bb): Returns a poly_bb_p. Do not take the reduction bool in parameter. Clear PBB_IS_REDUCTION. Set GBB_PBB. * graphite-poly.h (new_poly_bb): Update declaration. (gbb_from_bb): Moved here... (pbb_from_bb): New. * graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node): Removed. (graphite_stmt_p): Removed. (try_generate_gimple_bb): Returns a gimple_bb_p. Do not pass in sbitmap reductions. Always build a gimple_bb_p. Do not call new_poly_bb. (build_scop_bbs_1): Do not pass in sbitmap reductions. (build_scop_bbs): Same. (gbb_from_bb): ... from here. (add_conditions_to_constraints): Moved up. (analyze_drs): New. (build_scop_drs): Call analyze_drs. Remove all the PBBs that do not contain data references. (new_pbb_from_pbb): New. (insert_out_of_ssa_copy_on_edge): Call new_pbb_from_pbb after a block is split. (rewrite_close_phi_out_of_ssa): Update call to insert_out_of_ssa_copy_on_edge. (rewrite_reductions_out_of_ssa): Now static. (rewrite_cross_bb_scalar_deps_out_of_ssa): Same. (split_pbb): New. (split_reduction_stmt): Call split_pbb. (translate_scalar_reduction_to_array): Pass in the scop, do not pass in the sbitmap reductions. (rewrite_commutative_reductions_out_of_ssa_close_phi): Same. (rewrite_commutative_reductions_out_of_ssa_loop): Same. (rewrite_commutative_reductions_out_of_ssa): Same. (build_poly_scop): Call build_scop_bbs, rewrite_commutative_reductions_out_of_ssa, rewrite_reductions_out_of_ssa, and rewrite_cross_bb_scalar_deps_out_of_ssa. Move build_scop_drs before scop_to_lst. * graphite-sese-to-poly.h (rewrite_commutative_reductions_out_of_ssa): Removed declaration. (rewrite_reductions_out_of_ssa): Same. (rewrite_cross_bb_scalar_deps_out_of_ssa): Same. (build_scop_bbs): Same. * graphite.c (graphite_transform_loops): Do not initialize reductions. Do not call build_scop_bbs, rewrite_commutative_reductions_out_of_ssa, rewrite_reductions_out_of_ssa, and rewrite_cross_bb_scalar_deps_out_of_ssa. * sese.h (struct gimple_bb): Add field pbb. (GBB_PBB): New. * gcc.dg/graphite/pr45297.c: New. Added: trunk/gcc/testsuite/gcc.dg/graphite/pr45297.c Modified: trunk/gcc/ChangeLog trunk/gcc/ChangeLog.graphite trunk/gcc/graphite-poly.c trunk/gcc/graphite-poly.h trunk/gcc/graphite-sese-to-poly.c trunk/gcc/graphite-sese-to-poly.h trunk/gcc/graphite.c trunk/gcc/sese.h trunk/gcc/testsuite/ChangeLog
Fixed.
The new testcase fails on x86_64-apple-darwin10 as... FAIL: gcc.dg/graphite/pr45297.c (internal compiler error) FAIL: gcc.dg/graphite/pr45297.c (test for excess errors) with the error... /Users/howarth/darwin_objdir/gcc/xgcc -B/Users/howarth/darwin_objdir/gcc/ /Users/howarth/gcc/gcc/testsuite/gcc.dg/graphite/pr45297.c -Os -fgraphite-identity -S -m32 -o pr45297.s /Users/howarth/gcc/gcc/testsuite/gcc.dg/graphite/pr45297.c: In function 'foo': /Users/howarth/gcc/gcc/testsuite/gcc.dg/graphite/pr45297.c:4:1: internal compiler error: in rename_uses, at sese.c:533 which backtraces as... Breakpoint 1, fancy_abort (file=0x1009ea1e0 "../../gcc/gcc/sese.c", line=533, function=0x1009ea2fe "rename_uses") at ../../gcc/gcc/diagnostic.c:893 893 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) bt #0 fancy_abort (file=0x1009ea1e0 "../../gcc/gcc/sese.c", line=533, function=0x1009ea2fe "rename_uses") at ../../gcc/gcc/diagnostic.c:893 #1 0x0000000100663a2a in copy_bb_and_scalar_dependences (bb=<value temporarily unavailable, due to optimizations>, region=0x142032f40, next_e=0x143b27880, iv_map=0x14205a5c0) at ../../gcc/gcc/sese.c:533 #2 0x00000001004db6c2 in translate_clast (region=0x142032f40, context_loop=0x143a0ad48, stmt=0x142059a10, next_e=0x143b27840, newivs=0x7fff5fbfe388, newivs_index=0x14205a610, bb_pbb_mapping=0x142032d10, level=2, params_index=0x14203d000) at ../../gcc/gcc/graphite-clast-to-gimple.c:947 #3 0x00000001004dab17 in translate_clast (region=0x142032f40, context_loop=0x143a0ad48, stmt=0x14205d8f0, next_e=0x143b27840, newivs=0x7fff5fbfe388, newivs_index=0x14205a610, bb_pbb_mapping=0x142032d10, level=2, params_index=0x14203d000) at ../../gcc/gcc/graphite-clast-to-gimple.c:1138 #4 0x00000001004db564 in translate_clast_for_loop [inlined] () at /Users/howarth/gcc/gcc/graphite-clast-to-gimple.c:1028 #5 0x00000001004db564 in translate_clast_for [inlined] () at /Users/howarth/gcc/gcc/graphite-clast-to-gimple.c:1061 #6 0x00000001004db564 in translate_clast (region=0x142032f40, context_loop=0x143a0abb0, stmt=0x14205bab0, next_e=0x143b27440, newivs=0x7fff5fbfe388, newivs_index=0x14205a610, bb_pbb_mapping=0x142032d10, level=1, params_index=0x14203d000) at ../../gcc/gcc/graphite-clast-to-gimple.c:1116 #7 0x00000001004dab17 in translate_clast (region=0x142032f40, context_loop=0x143a0abb0, stmt=0x142059840, next_e=0x143b27440, newivs=0x7fff5fbfe388, newivs_index=0x14205a610, bb_pbb_mapping=0x142032d10, level=1, params_index=0x14203d000) at ../../gcc/gcc/graphite-clast-to-gimple.c:1138 #8 0x00000001004dbac1 in graphite_verify [inlined] () at /Users/howarth/gcc/gcc/graphite-clast-to-gimple.c:1553 #9 0x00000001004dbac1 in gloog (scop=<value temporarily unavailable, due to optimizations>, bb_pbb_mapping=0x142032d10) at ../../gcc/gcc/graphite-clast-to-gimple.c:1557 #10 0x00000001004d76a1 in graphite_transform_loops () at ../../gcc/gcc/graphite.c:284 #11 0x000000010079ce7a in graphite_transforms () at ../../gcc/gcc/tree-ssa-loop.c:296 #12 0x00000001005c9916 in execute_one_pass (pass=0x100bdbe00) at ../../gcc/gcc/passes.c:1553 #13 0x00000001005c9d7d in execute_pass_list (pass=0x100bdbe00) at ../../gcc/gcc/passes.c:1608 #14 0x00000001005c9d8f in execute_pass_list (pass=0x100bdbda0) at ../../gcc/gcc/passes.c:1609 #15 0x00000001005c9d8f in execute_pass_list (pass=0x100bdbb00) at ../../gcc/gcc/passes.c:1609 #16 0x00000001005c9d8f in execute_pass_list (pass=0x100bdb1a0) at ../../gcc/gcc/passes.c:1609 #17 0x00000001006ff990 in invoke_plugin_callbacks [inlined] () at /Users/howarth/gcc/gcc/plugin.h:422 #18 0x00000001006ff990 in tree_rest_of_compilation (fndecl=0x143b0b200) at ../../gcc/gcc/tree-optimize.c:425 #19 0x00000001008fabb9 in cgraph_expand_function (node=0x143b29000) at ../../gcc/gcc/cgraphunit.c:1508 #20 0x00000001008fdb5c in cgraph_expand_all_functions [inlined] () at /Users/howarth/gcc/gcc/cgraphunit.c:1567 #21 0x00000001008fdb5c in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1827 #22 0x00000001008fe021 in timevar_pop [inlined] () at /Users/howarth/gcc/gcc/timevar.h:1031 #23 0x00000001008fe021 in cgraph_finalize_compilation_unit () at ../../gcc/gcc/cgraphunit.c:1033 #24 0x000000010000c7af in c_write_global_declarations () at ../../gcc/gcc/c-decl.c:9840 #25 0x0000000100689f91 in do_compile () at ../../gcc/gcc/toplev.c:591 #26 0x000000010068a799 in toplev_main (argc=27, argv=0x7fff5fbfe800) at ../../gcc/gcc/toplev.c:1937 #27 0x0000000100001504 in start ()
Note that I see these failures with either ppl-0.10.2 and legacy cloog-ppl or ppl-0.11 and cloog-isl.
I see the same failure on amd64-linux with ./cc1 -m32 -Os -fgraphite-identity pr45297.c I will have a look at this.
In this code: <bb 3>: q_5 = &MEM[(void *)q_1 + 4294967288B]; <bb 4>: # q_1 = PHI <q_3(2), q_5(3)> if (q_1 != p_2(D)) goto <bb 3>; else goto <bb 5>; scev analysis is able to determine that q1 = {q_3, +, -8}_1 and in the same time, scev fails to analyze q5. And that triggers a rewrite of q_5 out of SSA making the scev analysis of q1 impossible.
*** Bug 46754 has been marked as a duplicate of this bug. ***
Author: spop Date: Thu Dec 2 20:13:11 2010 New Revision: 167390 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167390 Log: Fix PR45297: handle ADDR_EXPR in interpret_rhs_expr as in follow_ssa_edge_expr. 2010-12-01 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/45297 * tree-scalar-evolution.c (interpret_rhs_expr): Handle ADDR_EXPR with MEM_REFs as POINTER_PLUS_EXPR. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-scalar-evolution.c
Fixed again.