[PATCH] D40118: [Lint] Don't warn about noalias argument aliasing if other argument is byval

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 10:06:08 PST 2017


rnk added inline comments.


================
Comment at: lib/Analysis/Lint.cpp:269
+        if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy()) {
+          const AttributeList &PAL =
+            CS.isCall() ?
----------------
`AttributeList` is a lightweight pointer wrapper that is typically passed by value. No need for `const &` here.


================
Comment at: lib/Analysis/Lint.cpp:270-273
+            CS.isCall() ?
+             cast<CallInst>(CS.getInstruction())->getAttributes() :
+             cast<InvokeInst>(CS.getInstruction())->getAttributes();
+
----------------
This can be simplified to just CS.getAttributes().


================
Comment at: lib/Analysis/Lint.cpp:275
+          unsigned ArgNo = 0;
+          for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI) {
+            // Skip ByVal arguments since they will be memcpy'd to the callee's
----------------
`for (Value *OtherArg : CS.args()) {` ?


https://reviews.llvm.org/D40118





More information about the llvm-commits mailing list