https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120360

--- Comment #3 from Linus Torvalds <torva...@linux-foundation.org> ---
(In reply to Linus Torvalds from comment #2)
>
> Stupid test-case:

Actually, that was a bit *too* stupid, since it doesn't show the effect of "we
still need the original value afterwards".

So change it to

  void failure(void *ptr)
  {
        if (MY_IS_ERR_OR_NULL(ptr)) do_something(ptr);
  }

to show why the 'add' is bad because it generates extra pointless register
pressure:

        movq    %rdi, %rax
        addq    $4095, %rax
        jns     .L4

(and obviously in this test-case that does nothing else, there is no other
register use, so the "register pressure" is a non-issue and it all just results
in one pointless "mov" instruction - but on real code it tends to result in
more spills and just odd code).

Reply via email to