[PATCH] D123090: MemoryBuiltins: start using properties of functions
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 20 13:52:17 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:103
+AllocFnKind allocKindFromAllocType(AllocType AT) {
+ AllocFnKind K = AllocFnKind::Unknown;
----------------
Function is unused (at least in this patch).
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:301-302
+ if (CB) {
+ if (CB->hasFnAttr(Attribute::AllocKind))
+ return AllocFnKind(CB->getFnAttr(Attribute::AllocKind).getValueAsInt());
+ else
----------------
To avoid duplicate lookup. Same below.
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:315
+static bool checkFnAllocKind(const Value *V,
+ ArrayRef<llvm::AllocFnKind> Wanted) {
+ Optional<AllocFnKind> OAFK = getAllocFnKind(V);
----------------
It would probably be simpler to just pass in (for example) `AllocFnKind::Alloc | AllocFnKind::Realloc` and then check that `*OAFK & Wanted != 0`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123090/new/
https://reviews.llvm.org/D123090
More information about the llvm-commits
mailing list