isKnownNonZero() can determine nonnull-ness from a dominating call with a nonnull parameter. Currently, this works by inspecting the attributes on the called function.
This code currently crashes with opaque pointers if the call-site and the called function have a different number of arguments (which no longer requires a bitcast to sit in between). Fix this by directly working with the call arguments instead.
As seen by changes on existing tests, this has the additional benefit that we now take into account attributes that are present only on the callsite, and not on the function declaration.
Unfortunately, this means we need to duplicate the function-level Attribute::hasNonNullAttr() logic into a call-level CallBase::paramIsNonNull() function.
I wonder if (some or most of) this logic could be factored out of here and Argument::hasNonNullAttr() if the common implementation took the Type and an AttributeList as parameters?