[InstCombine] Missed optimizations when null check before return statement


Please check code:

Clang surprisingly generates worse code for common pattern
if (!ptr)
return NULL;

than for

if (!ptr)
return ptr;

Gcc generates same code.

I checked the InstCombine’s code and tried something to fix it but no success.
So I will leave this here for more skilled developers and maybe the could fix this problem.