[llvm] Support non-malloc functions in malloc+memset->calloc fold (PR #138299)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 00:52:57 PDT 2025
================
@@ -2377,6 +2377,32 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
CheckFailed("'allockind()' can't be both zeroed and uninitialized");
}
+ if (Attrs.hasFnAttr("alloc-variant-zeroed")) {
+ if (auto A = Attrs.getFnAttr("alloc-variant-zeroed"); A.isValid()) {
+ StringRef s = A.getValueAsString();
+ Check(!s.empty(), "\"alloc-variant-zeroed\" must not be empty");
+ if (auto *F = dyn_cast<Function>(V)) {
----------------
nikic wrote:
We should also verify that F and the Variant have the same function type (i.e. signature).
https://github.com/llvm/llvm-project/pull/138299
More information about the llvm-commits
mailing list