[PATCH] D117921: Attributes: add a new allocalign() attribute

Augie Fackler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 09:14:03 PST 2022


durin42 marked 5 inline comments as done.
durin42 added inline comments.


================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:339
 
-  const Optional<AllocFnsTy> FnData = getAllocationData(V, AnyAlloc, TLI);
-  if (!FnData.hasValue() || FnData->AlignParam < 0) {
-    return nullptr;
+  const CallBase *CB = cast<CallBase>(V);
+  if (CB->hasFnAttr(Attribute::AllocAlign)) {
----------------
jyknight wrote:
> reames wrote:
> > To parallel the allocsize path, we need builtin knowledge to overrule attributed knowledge.  
> Why does allocsize work that way? I'd generally expect an attribute to take precedence if specified?
I'm new to compilers at all and LLVM in particular, but I really would have expected an attribute to overrule builtin knowledge too, to the point that I didn't check how allocsize was set up. For now I'm making it consistent, but it does seem backwards.

Also, the "use the attribute" part of this has moved to a new change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117921



More information about the llvm-commits mailing list