Skip to content

Local: Handle noalias.addrspace in copyMetadataForLoad #103939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Aug 14, 2024

No description provided.

Copy link
Contributor Author

arsenm commented Aug 14, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @arsenm and the rest of your teammates on Graphite Graphite

@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/103939.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+1)
  • (modified) llvm/test/Transforms/InstCombine/loadstore-metadata.ll (+1-1)
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index bbc8933d387e1..884ace14b90b7 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -3398,6 +3398,7 @@ void llvm::copyMetadataForLoad(LoadInst &Dest, const LoadInst &Source) {
     case LLVMContext::MD_mem_parallel_loop_access:
     case LLVMContext::MD_access_group:
     case LLVMContext::MD_noundef:
+    case LLVMContext::MD_noalias_addrspace:
       // All of these directly apply.
       Dest.setMetadata(ID, N);
       break;
diff --git a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
index 247a02f0bcc14..dccbfbd13f73d 100644
--- a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
+++ b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
@@ -177,7 +177,7 @@ define i32 @test_load_cast_combine_noalias_addrspace(ptr %ptr) {
 ; Ensure (cast (load (...))) -> (load (cast (...))) preserves TBAA.
 ; CHECK-LABEL: @test_load_cast_combine_noalias_addrspace(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[L1:%.*]] = load i32, ptr [[PTR:%.*]], align 4
+; CHECK-NEXT:    [[L1:%.*]] = load i32, ptr [[PTR:%.*]], align 4, !noalias.addrspace [[META10:![0-9]+]]
 ; CHECK-NEXT:    ret i32 [[L1]]
 ;
 entry:

@arsenm arsenm force-pushed the users/arsenm/combine-metadata-preserve-noalias-addrspace branch from 1952386 to 0f1cd91 Compare September 20, 2024 12:02
@arsenm arsenm force-pushed the users/arsenm/copy-metadata-for-load-noalias-addrspace branch from 1f6e229 to a9627b2 Compare September 20, 2024 12:02
@arsenm arsenm force-pushed the users/arsenm/combine-metadata-preserve-noalias-addrspace branch from 0f1cd91 to 3ff8ae8 Compare September 24, 2024 04:36
@arsenm arsenm force-pushed the users/arsenm/copy-metadata-for-load-noalias-addrspace branch from a9627b2 to 865a467 Compare September 24, 2024 04:36
@arsenm arsenm force-pushed the users/arsenm/combine-metadata-preserve-noalias-addrspace branch from 3ff8ae8 to f7b9b84 Compare October 7, 2024 20:13
@arsenm arsenm force-pushed the users/arsenm/copy-metadata-for-load-noalias-addrspace branch from 865a467 to 7dcad20 Compare October 7, 2024 20:13
@arsenm arsenm force-pushed the users/arsenm/combine-metadata-preserve-noalias-addrspace branch from f7b9b84 to 4e5e920 Compare October 8, 2024 18:21
@arsenm arsenm force-pushed the users/arsenm/copy-metadata-for-load-noalias-addrspace branch from 7dcad20 to b655b4c Compare October 8, 2024 18:21
@arsenm
Copy link
Contributor Author

arsenm commented Oct 9, 2024

ping

@@ -177,7 +177,7 @@ define i32 @test_load_cast_combine_noalias_addrspace(ptr %ptr) {
; Ensure (cast (load (...))) -> (load (cast (...))) preserves TBAA.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this comment reference noalias.addrspace rather than TBAA?

Copy link
Contributor

@frasercrmck frasercrmck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than nit

@arsenm arsenm merged commit 8c22443 into users/arsenm/combine-metadata-preserve-noalias-addrspace Oct 9, 2024
8 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/copy-metadata-for-load-noalias-addrspace branch October 9, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants