[PATCH] D105313: [ValueTracking] Use call arguments for nonnull attribute check
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 2 12:06:38 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/IR/Instructions.cpp:325
+bool CallBase::paramIsNonNull(unsigned ArgNo, bool AllowUndefOrPoison) const {
+ Type *ArgType = getArgOperand(ArgNo)->getType();
----------------
dexonsmith wrote:
> 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?
I gave this a try: https://gist.github.com/nikic/d1ce3f7a7488be786974e040648a65e0
I'm not sure this really makes things better. Ultimately, the core logic here is simple, and moving it to AttributeSet means that we instead need to duplicate the "call or callee attributes" logic, so it ends up being bulkier overall.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105313/new/
https://reviews.llvm.org/D105313
More information about the llvm-commits
mailing list