https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120043
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |15.1.0 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- I'll have a look. Yes, tree_could_trap_p does not know whether it sees a load or a store. OTOH another issue is that we turn *b = 1 into a = 1 with conditional propagation: <bb 2> [local count: 1073741824]: b.1_1 = b; if (b.1_1 != &a) goto <bb 4>; [70.00%] else goto <bb 3>; [30.00%] <bb 3> [local count: 322122544]: a = 1; <bb 4> [local count: 1073741824]: return 0; handling this in tree_could_trap_p conservatively would be quite prohibiting. There is ifcvt_memrefs_wont_trap from if-conversion that handles this case correctly (but it uses flow analysis to improve results). I'll see to fix cselim and enhance tree_could_trap_p with a lhs_p flag.