[clang] [llvm] [Inliner] Propagate more attributes to params when inlining (PR #91101)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 14:32:14 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);
----------------
andjo403 wrote:

What is the reason to poison all values if exactIntersectWith is returning nullopt? is it not better to remove the range attribute instead of setting an empty range? or selecting the smallest range as is done by calling `intersectWith` feels like it is possible to assume that both ranges are valid only that the intersection gives multiple ranges.

https://github.com/llvm/llvm-project/pull/91101


More information about the llvm-commits mailing list