[PATCH] D93927: [ArgPromotion] Copy !range metadata for loads.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 11 10:24:26 PST 2021


fhahn added a comment.

In D93927#2618615 <https://reviews.llvm.org/D93927#2618615>, @wecing wrote:

> Only copy seleted metadata.
>
> Thank you @fhahn for the response. I went through the metadata types mentioned in https://llvm.org/docs/LangRef.html#load-instruction, and those listed in https://llvm.org/docs/LangRef.html#metadata that mentiones could be used on 'load', and hand picked those I think should be safe to copy.

The attributes in question look like a good start to me, thanks.



================
Comment at: llvm/test/Transforms/ArgumentPromotion/metadata.ll:5
+; CHECK-LABEL: define i32 @should_copy_range(
+; CHECK:         %x.idx = getelementptr { i32, i32 }, { i32, i32 }* %x, i64 0, i32 0
+; CHECK-NEXT:    %x.idx.val = load i32, i32* %x.idx, align 4, !range !0
----------------
If you are checking the full IR, you may want to use `llvm/utils/update_test_checks.py` to auto-generate the checks. The auto-generated checks use regular expressions + variables for value names, so they are less prone to break when value names change due to unrelated changes.


================
Comment at: llvm/test/Transforms/ArgumentPromotion/metadata.ll:10
+;
+  %1 = call i32 @f_load_range({ i32, i32 }* %x)
+  ret i32 %1
----------------
Would a simple pointer type also work, or do we need a struct?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93927/new/

https://reviews.llvm.org/D93927



More information about the llvm-commits mailing list