On Fri, Aug 27, 2010 at 5:27 PM, Hongtao <yu...@purdue.edu> wrote: > Hi all, > > I have instrumented a function call like foo(&a,&b) into the gimple SSA > representation (gcc-4.5) and the consequent optimizations can not pass > my instrumented code. The back traces are as followings. The error > occurred when the pass dse tried to test if the call I inserted may use > a memory reference. It is because the arguments &a is not a SSA_VAR or > INDIRECT_REF, so the assert in function > > bool > refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) > > gcc_assert ((!ref1->ref > || SSA_VAR_P (ref1->ref) > || handled_component_p (ref1->ref) > || INDIRECT_REF_P (ref1->ref) > || TREE_CODE (ref1->ref) == TARGET_MEM_REF > || TREE_CODE (ref1->ref) == CONST_DECL) > && (!ref2->ref > || SSA_VAR_P (ref2->ref) > || handled_component_p (ref2->ref) > || INDIRECT_REF_P (ref2->ref) > || TREE_CODE (ref2->ref) == TARGET_MEM_REF > || TREE_CODE (ref2->ref) == CONST_DECL)); > was violated. > > Does anyone know why the function arguments must be a SSA_VAR or > INDIRECT_REF here? Have I missed to perform any actions to maintain the > consistency of Gimple SSA?
Yes. is_gimple_val () will return false for your arguments as it seems that the variables do not have function invariant addresses. Richard. > > #0 0x00007ffff6fc8ee0 in exit () from /lib/libc.so.6 > #1 0x00000000005ae4ce in diagnostic_action_after_output > (context=0x1323880, diagnostic=0x7fffffffd870) at > ../../src/gcc/diagnostic.c:198 > #2 0x00000000005aed54 in diagnostic_report_diagnostic > (context=0x1323880, diagnostic=0x7fffffffd870) at > ../../src/gcc/diagnostic.c:424 > #3 0x00000000005afdc3 in internal_error (gmsgid=0xddfb57 "in %s, at > %s:%d") at ../../src/gcc/diagnostic.c:709 > #4 0x00000000005aff4f in fancy_abort (file=0xe42670 > "../../src/gcc/tree-ssa-alias.c", line=786, function=0xe427e0 > "refs_may_alias_p_1") > at ../../src/gcc/diagnostic.c:763 > #5 0x00000000008a1adb in refs_may_alias_p_1 (ref1=0x7fffffffdab0, > ref2=0x7fffffffdb50, tbaa_p=1 '\001') > at ../../src/gcc/tree-ssa-alias.c:775 > #6 0x00000000008a2b12 in ref_maybe_used_by_call_p_1 > (call=0x7ffff6790630, ref=0x7fffffffdb50) at > ../../src/gcc/tree-ssa-alias.c:1133 > #7 0x00000000008a2d2e in ref_maybe_used_by_call_p (call=0x7ffff6790630, > ref=0x7ffff6848048) at ../../src/gcc/tree-ssa-alias.c:1147 > #8 0x00000000008a2dfa in ref_maybe_used_by_stmt_p (stmt=0x7ffff6790630, > ref=0x7ffff6848048) at ../../src/gcc/tree-ssa-alias.c:1179 > #9 0x00000000008bf275 in dse_possible_dead_store_p > (stmt=0x7ffff683e820, use_stmt=0x7fffffffdca8) at > ../../src/gcc/tree-ssa-dse.c:212 > #10 0x00000000008bfeb9 in dse_optimize_stmt (dse_gd=0x7fffffffddd0, > bd=0x156bd30, gsi=...) at ../../src/gcc/tree-ssa-dse.c:297 > #11 0x00000000008c029d in dse_enter_block (walk_data=0x7fffffffdde0, > bb=0x7ffff6a75068) at ../../src/gcc/tree-ssa-dse.c:370 > #12 0x0000000000cc26a5 in walk_dominator_tree (walk_data=0x7fffffffdde0, > bb=0x7ffff6a75068) at ../../src/gcc/domwalk.c:185 > #13 0x00000000008c0812 in tree_ssa_dse () at > ../../src/gcc/tree-ssa-dse.c:430 > #14 0x000000000073af0a in execute_one_pass (pass=0x13cced0) at > ../../src/gcc/passes.c:1572 > #15 0x000000000073b21a in execute_pass_list (pass=0x13cced0) at > ../../src/gcc/passes.c:1627 > #16 0x000000000073b238 in execute_pass_list (pass=0x1312720) at > ../../src/gcc/passes.c:1628 > #17 0x000000000086e372 in tree_rest_of_compilation > (fndecl=0x7ffff6b93500) at ../../src/gcc/tree-optimize.c:413 > #18 0x00000000009fa7c5 in cgraph_expand_function (node=0x7ffff6be7000) > at ../../src/gcc/cgraphunit.c:1548 > #19 0x00000000009faa49 in cgraph_expand_all_functions () at > ../../src/gcc/cgraphunit.c:1627 > #20 0x00000000009fb07e in cgraph_optimize () at > ../../src/gcc/cgraphunit.c:1875 > #21 0x00000000009f9461 in cgraph_finalize_compilation_unit () at > ../../src/gcc/cgraphunit.c:1096 > #22 0x00000000004a9e93 in c_write_global_declarations () at > ../../src/gcc/c-decl.c:9519 > #23 0x00000000008180d4 in compile_file () at ../../src/gcc/toplev.c:1065 > #24 0x000000000081a1c5 in do_compile () at ../../src/gcc/toplev.c:2417 > #25 0x000000000081a286 in toplev_main (argc=21, argv=0x7fffffffe0f8) at > ../../src/gcc/toplev.c:2459 > #26 0x0000000000519c6b in main (argc=21, argv=0x7fffffffe0f8) at > ../../src/gcc/main.c:35 > > Thanks, > > Hongtao > Purdue University > > >