[PATCH] D117241: [Attributor] Share code for abstract interpretation of allocation sizes with getObjectSize [NFC-ish]
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 15:35:03 PST 2022
jdoerfert added a comment.
LG, minor nits below though
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:364
+ const ConstantInt *Arg =
+ dyn_cast<ConstantInt>(Mapper(CB->getArgOperand(FnData->FstParam)));
+ if (!Arg)
----------------
nit: dyn_cast_or_null or document the mapper should not return a nullptr. I prefer the former.
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:376
+
+ Arg = dyn_cast<ConstantInt>(Mapper(CB->getArgOperand(FnData->SndParam)));
+ if (!Arg)
----------------
same as above.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:6022
+ bool Dead = false;
+ if (Optional<Constant *> SimpleV = A.getAssumedConstant(*V, AA, Dead))
+ if (*SimpleV)
----------------
Nit: Not "Dead" but "UsedAssumedInformation". That will need to be exposed once we want to "fix" AllocationInfos in H2S early to avoid looking at them again in future updates. For now, I'd just use the canonical name here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117241/new/
https://reviews.llvm.org/D117241
More information about the llvm-commits
mailing list