https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78655
--- Comment #4 from Ivan Sorokin <vanyacpp at gmail dot com> --- (In reply to Richard Biener from comment #1) > + if (flag_delete_null_pointer_checks > + && is_gimple_assign (stmt) > + && is_gimple_assign (stmt) Duplicate conjunct. > + && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR > + && tree_expr_nonzero_p (gimple_assign_rhs2 (stmt))) > + return true; > + > return false; > } I thought a bit more about the issue. I think that not only the result of pointer-integer addition, but also its argument are values that could be proven non-zero. Consider the following example: bool f(int* a) { bool x = a == nullptr; a += 10; return x; } In this example x could be proven to be false. Because if it is true then (a+=10) causes undefined behavior. At the moment clang doesn't optimize this. I don't any real example when this is needed. Just the way this optimization can be made more widely applicable.