> The following testcase is miscompiled on i686-linux at -O3. > The bug is in DSE record_store, which for group_id < 0 uses mem_addr > set to result of get_addr (base->val_rtx) (plus optional offset), > which is fine for canon_true_dependence with other MEMs in that function, > but we also store that address in store_info. The problem is if later on > e.g. some read uses the same e.g. hard register as get_addr returned, but > that register contains at that later point a different value. > canon_true_dependence then happily returns the read does not alias the > store, although it might. > The fix is to store the VALUE (plus optional offset) into > store_info->mem_addr instead, then at some later insn when get_addr is > called on it it will either return the same register or expression (if it > has not changed), or some different one otherwise.
I presume that the origin of the bug is: /* get_addr can only handle VALUE but cannot handle expr like: VALUE + OFFSET, so call get_addr to get original addr for mem_addr before plus_constant. */ mem_addr = get_addr (mem_addr); if (offset) mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset); both in record_store and check_mem_read_rtx, so I wonder if we shouldn't bite the bullet and try enhancing get_addr since it's a mainline-only regression. -- Eric Botcazou