[PATCH] D123086: BuildLibCalls: add alloc-family attribute to many allocator functions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 12:36:24 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/BuildLibCalls.cpp:458
   case LibFunc_vec_malloc:
+    Changed |= setAllocFamily(F, "vec_malloc");
     Changed |= setAllocSize(F, 0, None);
----------------
I just looked at this again, and while this does actually end up doing the right thing, I think it's very subtle. It would be better to rewrite this like so (without the separate fallthrough):

```
Changed |= setAllocFamility(F, TheLibFunc == LibFunc_vec_malloc ? "vec_malloc" : "malloc");
```

It also looks like we currently don't have tests for the vec_malloc case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123086



More information about the llvm-commits mailing list