As discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-December/108182.html
...we should be able to propagate 'nonnull' info from a callsite back to its parent.
The original motivation for this patch is our botched optimization of "dyn_cast" (PR28430), but this won't solve that problem alone.
I think this is the strongest nonnull transform of this type because tagging the argument can enable transforms for all other instructions in the function. Possible follow-ups would handle cases where we can use nonnull to directly eliminate an icmp (InstSimplify+ValueTracking), or add llvm.assume to trigger existing transforms.
I know this was request earlier in the review thread, but there are lots of cases where inlining drops information available at the call site. This isn't specific to this case. Doesn't hurt to call it out, but the wording seems to imply this is unique to this inference which it really isn't.