https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87624
Bug ID: 87624 Summary: improve interprocedural clean up of null pointer checks Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: amonakov at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- On the following example the 'p' argument in 'f' can be proven to be nonnull. In practice this should help to clean up null pointer checks that become redundant in LTO mode. Is that something IPA-VRP could handle? I think currently it doesn't work because there isn't a separate SSA name under the check that can be recorded to be non-null? void g(void); __attribute__((noinline)) static void f(void *p) { if (!p) g(); } void h(void *p1, void *p2) { if (p1) f(p1); if (p2) f(p2); }