================ @@ -1352,20 +1352,43 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB, auto &Context = CalledFunction->getContext(); // Collect valid attributes for all params. - SmallVector<AttrBuilder> ValidParamAttrs; + SmallVector<AttrBuilder> ValidObjParamAttrs, ValidExactParamAttrs; bool HasAttrToPropagate = false; for (unsigned I = 0, E = CB.arg_size(); I < E; ++I) { - ValidParamAttrs.emplace_back(AttrBuilder{CB.getContext()}); + ValidObjParamAttrs.emplace_back(AttrBuilder{CB.getContext()}); + ValidExactParamAttrs.emplace_back(AttrBuilder{CB.getContext()}); // Access attributes can be propagated to any param with the same underlying // object as the argument. if (CB.paramHasAttr(I, Attribute::ReadNone)) - ValidParamAttrs.back().addAttribute(Attribute::ReadNone); + ValidObjParamAttrs.back().addAttribute(Attribute::ReadNone); if (CB.paramHasAttr(I, Attribute::ReadOnly)) - ValidParamAttrs.back().addAttribute(Attribute::ReadOnly); + ValidObjParamAttrs.back().addAttribute(Attribute::ReadOnly); if (CB.paramHasAttr(I, Attribute::WriteOnly)) - ValidParamAttrs.back().addAttribute(Attribute::WriteOnly); - HasAttrToPropagate |= ValidParamAttrs.back().hasAttributes(); + ValidObjParamAttrs.back().addAttribute(Attribute::WriteOnly); + + // Attributes we can only propagate if the exact parameter is forwarded. + + // We can propagate both poison generating an UB generating attributes ---------------- goldsteinn wrote:
Thanks, fixed. https://github.com/llvm/llvm-project/pull/91101 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits