[PATCH] D121641: MemoryBuiltins: also check function definition for allocalign
Augie Fackler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 14 14:25:50 PDT 2022
durin42 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
durin42 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This got changed to use hasAttrSomewhere() during review, and I didn't
notice until today when I was writing some tests for another part of
this system that using hasAttrSomewhere only checked the callsite for
allocalign, rather than both the callsite and the definition. This fixes
that, which is what we intended all along.
Depends on D121640 <https://reviews.llvm.org/D121640>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121641
Files:
llvm/lib/Analysis/MemoryBuiltins.cpp
Index: llvm/lib/Analysis/MemoryBuiltins.cpp
===================================================================
--- llvm/lib/Analysis/MemoryBuiltins.cpp
+++ llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -336,9 +336,12 @@
return V->getOperand(FnData->AlignParam);
}
unsigned AllocAlignParam;
+ const Function *F = V->getCalledFunction();
if (V->getAttributes().hasAttrSomewhere(Attribute::AllocAlign,
- &AllocAlignParam)) {
- return V->getOperand(AllocAlignParam-1);
+ &AllocAlignParam) ||
+ (F && F->getAttributes().hasAttrSomewhere(Attribute::AllocAlign,
+ &AllocAlignParam))) {
+ return V->getOperand(AllocAlignParam - 1);
}
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121641.415228.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220314/c78282ab/attachment.bin>
More information about the llvm-commits
mailing list