[clang] [llvm] [Inliner] Propagate more attributes to params when inlining (PR #91101)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 10:43:45 PDT 2024
================
@@ -1427,8 +1429,20 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
ValidExactParamAttrs[ArgNo].getAlignment().valueOrOne())
AL = AL.removeParamAttribute(Context, I, Attribute::Alignment);
+ auto ExistingRange = AL.getParamRange(I);
AL = AL.addParamAttributes(Context, I, ValidExactParamAttrs[ArgNo]);
+ // For range we use the exact intersection.
+ if (ExistingRange.has_value()) {
+ if (auto NewRange = ValidExactParamAttrs[ArgNo].getRange()) {
+ auto CombinedRange = ExistingRange->exactIntersectWith(*NewRange);
+ if (!CombinedRange.has_value())
+ CombinedRange =
+ ConstantRange::getEmpty(NewRange->getBitWidth());
+ AL = AL.removeParamAttribute(Context, I, Attribute::Range);
----------------
goldsteinn wrote:
> hmm if I have not missed something in the end this will be called
>
> https://github.com/llvm/llvm-project/blob/3591da9f1ccbd8b19fef4814f96638dbbe9c2b40/llvm/lib/IR/Attributes.cpp#L1782-L1790
>
>
> so swap will be called and replace the current value or?
Its from the `Merge` call in `addAttributesAtIndex`.
https://github.com/llvm/llvm-project/pull/91101
More information about the cfe-commits
mailing list