> > How is that different from:
> > struct S { long long d; int e; };
> > struct T { long long d; long long e; };
> > s->e vs. t->e ?
> > One thing is comparison of the address (as it is comparing
> > DECL_FIELD_BIT_OFFSET too, it is essentially bit-address), and another thing
> > (unlrelated to OEP_ADDRESS comparisons) is if you need to ensure the access
> > has the same size, in that case you just compare the bit size of the 
> > access...
> 
> I believe for that I only need to compare TYPE_SIZE of the access.
> Bitfields are special since their types are wider and they do extension.

So the extra sanity check fires in

0xe3d093 operand_compare::operand_equal_p(tree_node const*, tree_node const*, 
unsigned int)
        ../../gcc/fold-const.c:3329
0xe4066d operand_equal_p(tree_node const*, tree_node const*, unsigned int)
        ../../gcc/fold-const.c:3949
0x167fad5 refs_hasher::equal(ref_to_bb const*, ref_to_bb const*)
        ../../gcc/tree-ssa-phiopt.c:2152
0x1680555 hash_table<refs_hasher, false, 
xcallocator>::find_slot_with_hash(ref_to_bb* const&, unsigned int, 
insert_option)
        ../../gcc/hash-table.h:981
0x16802d6 hash_table<refs_hasher, false, xcallocator>::find_slot(ref_to_bb* 
const&, insert_option)
        ../../gcc/hash-table.h:435
0x167b4f2 nontrapping_dom_walker::add_or_mark_expr(basic_block_def*, 
tree_node*, bool)
        ../../gcc/tree-ssa-phiopt.c:2261
0x167b380 nontrapping_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/tree-ssa-phiopt.c:2211
0x23705e1 dom_walker::walk(basic_block_def*)
        ../../gcc/domwalk.c:309
0x167b637 get_non_trapping
        ../../gcc/tree-ssa-phiopt.c:2308
0x167410e tree_ssa_phiopt_worker
        ../../gcc/tree-ssa-phiopt.c:177
0x1673f65 tree_ssa_cs_elim
        ../../gcc/tree-ssa-phiopt.c:127
0x167d84c execute
        ../../gcc/tree-ssa-phiopt.c:3192

This makes sort of sense: refs hasher is trying to prove that two
accesses go to exactly same location to eliminate NULL pointer checks.
If my ao_ref_compare gets approved (that is I guess not at all clear at
this point) I suppose we could use it here.  We want only accesses to
have same address&size, we do not care about TBAA properties here.

It is not obvious to me how this optimization is safe without
-fnon-call-exceptions though.

I will test the patch without assert for now.

Honza

Reply via email to