================
@@ -1393,12 +1395,58 @@ static RValue EmitNewDeleteCall(CodeGenFunction &CGF,
///
/// We model such elidable calls with the 'builtin' attribute.
llvm::Function *Fn = dyn_cast<llvm::Function>(CalleePtr);
- if (CalleeDecl->isReplaceableGlobalAllocationFunction() && Fn) {
- if (Fn->hasFnAttribute(llvm::Attribute::NoBuiltin))
+ UnsignedOrNone AlignArg = std::nullopt;
+ if (CalleeDecl->isReplaceableGlobalAllocationFunction(&AlignArg)) {
+ auto &Ctx = CallOrInvoke->getContext();
+ llvm::AllocFnKind AK = llvm::AllocFnKind::Unknown;
+ bool IsDeleter = CalleeDecl->getOverloadedOperator() == OO_Array_Delete ||
+ CalleeDecl->getOverloadedOperator() == OO_Delete;
+ if (IsDeleter) {
+ AK = AK | llvm::AllocFnKind::Free;
+ } else {
+ if (AlignArg)
+ AK = llvm::AllocFnKind::Aligned;
+ AK = AK | llvm::AllocFnKind::Alloc | llvm::AllocFnKind::Uninitialized;
+ }
+ ASTContext &ASTCtx = CalleeDecl->getASTContext();
+ ASTNameGenerator gen = ASTNameGenerator(ASTCtx);
+ std::string Mangled = gen.getName(CalleeDecl);
----------------
durin42 wrote:
Sure. It felt...wrong to not invoke the mangler, but when in Rome.
https://github.com/llvm/llvm-project/pull/239732
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits