https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90663
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2019-05-29 Component|tree-optimization |middle-end Target Milestone|--- |7.5 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- &a[2] &MEM[(void *)&a + 2B] that's two equivalent ways of writing the same address but they are not equal as far as operand_equal_p is concerned. More "precise" equality can be determined by using get_addr_base_and_unit_offset (for addresses that are known not to be variable) or get_inner_reference (for the rest). Note the latter eventually relies on similar foldings / canonicalizations being applied when the variable offset tree is built. Even more precise equivalence may be obtained by using tree-affine but that's even more expensive. What we lack is a get_inner_reference_aff that doesn't first use get_inner_reference and thus avoids building/folding of the GENERIC offset tree. operand_equal_p is (more-or-less) checking for syntactical equivalence while here we want value equivalence. Anyhow, I suggest to use get_addr_base_and_unit_offset in the gimple folder since there variable addresses will not appear literally but only in separate SSA defs.