[llvm] [DeadArgElim] Renumber allocsize instead of dropping it (PR #221868)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 00:59:25 PDT 2026
================
@@ -839,9 +854,42 @@ bool DeadArgumentEliminationPass::removeDeadStuffFromFunction(Function *F) {
AttributeSet RetAttrs = AttributeSet::get(F->getContext(), RAttrs);
- // Strip allocsize attributes. They might refer to the deleted arguments.
- AttributeSet FnAttrs =
- PAL.getFnAttrs().removeAttribute(F->getContext(), Attribute::AllocSize);
+ // allocsize names parameters by index, so deleting an argument ahead of one
+ // renumbers it. surveyFunction() keeps the arguments allocsize points at
+ // alive, so renumber the attribute rather than dropping it; drop it only if
+ // they went away regardless, which leaves the callee no way to report the
+ // size it allocates.
----------------
nikic wrote:
As you are forcing the allocsize arguments to be live now, under what circumstances can the go away "regardless"?
https://github.com/llvm/llvm-project/pull/221868
More information about the llvm-commits
mailing list