[PATCH] D123090: MemoryBuiltins: start using properties of functions

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 11:03:37 PDT 2022


bogner added inline comments.


================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:106
+  AllocFnKind K = AllocFnKind::Unknown;
+  if (AT & OpNewLike)
+    K |= AllocFnKind::Alloc | AllocFnKind::Uninitialized;
----------------
nikic wrote:
> I'd probably check these with `==` as they are mutually exclusive. Makes it more obvious that you can't end up with a combination from multiple branches here.
They aren't necessarily mutually exclusive though, since `AllocType` has things like `MallocOrCallocLike`, no? 

However, the current code will set both the `AllocFnKind::Uninitialized` and `AllocFnKind::Zeroed` bits in that case, which seems wrong.


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