[PATCH] D103288: [SanCov] Properly set ABI parameter attributes

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 09:11:40 PDT 2021


aeubanks added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:845
+                              {IRB.CreateIntCast(A1, Ty, true)});
+    if (CallbackIdx == 0) {
+      CB->addParamAttr(0, Attribute::ZExt);
----------------
nikic wrote:
> rnk wrote:
> > Can we do something like `CB->setAttributes(CB->getDirectCallee()->getAttributes()` that avoids duplicating the knowledge of the ABI attributes to the call site? We know at this point that the constructed call will be direct, nothing stops this code from looking at the callee.
> Is there anything preventing us from doing this directly in IRBuilder? Is there some situation where we //don't// want to inherit attributes from the declaration?
In the case of indirect calls, we don't have a callee to look at. It would be unintuitive to only sometimes copy attributes depending on whether the call is direct or not.
In these cases we know that we're creating a direct call.

We could create a separate `IRBuilder::CreateDirectCall()` which does that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103288/new/

https://reviews.llvm.org/D103288



More information about the llvm-commits mailing list