[clang] [llvm] [Inliner] Propagate more attributes to params when inlining (PR #91101)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 5 12:31:56 PDT 2024
================
@@ -1381,21 +1405,58 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
AttributeList AL = NewInnerCB->getAttributes();
for (unsigned I = 0, E = InnerCB->arg_size(); I < E; ++I) {
// Check if the underlying value for the parameter is an argument.
- const Value *UnderlyingV =
- getUnderlyingObject(InnerCB->getArgOperand(I));
- const Argument *Arg = dyn_cast<Argument>(UnderlyingV);
- if (!Arg)
- continue;
+ const Argument *Arg = dyn_cast<Argument>(InnerCB->getArgOperand(I));
+ unsigned ArgNo;
+ if (Arg) {
+ ArgNo = Arg->getArgNo();
+ // For dereferenceable, dereferenceable_or_null, align, etc...
+ // we don't want to propagate if the existing param has the same
+ // attribute with "better" constraints. So, only remove from the
+ // existing AL if the region of the existing param is smaller than
+ // what we can propagate. AttributeList's merge API honours the
+ // already existing attribute value so we choose the "better"
+ // attribute by removing if the existing one is worse.
----------------
goldsteinn wrote:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/InlineFunction.cpp#L1500
Is a bit confusing...
https://github.com/llvm/llvm-project/pull/91101
More information about the cfe-commits
mailing list