[llvm] 410a5b1 - Local: Handle noalias.addrspace in copyMetadataForLoad (#130123)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 6 16:17:58 PST 2025


Author: Matt Arsenault
Date: 2025-03-07T07:17:54+07:00
New Revision: 410a5b151888131b727826d9b030b7df134dacc9

URL: https://github.com/llvm/llvm-project/commit/410a5b151888131b727826d9b030b7df134dacc9
DIFF: https://github.com/llvm/llvm-project/commit/410a5b151888131b727826d9b030b7df134dacc9.diff

LOG: Local: Handle noalias.addrspace in copyMetadataForLoad (#130123)

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Local.cpp
    llvm/test/Transforms/InstCombine/loadstore-metadata.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 6d7c710020c3e..95f0d099aacb5 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -3460,6 +3460,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 5a977882504ce..859c9b892f156 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:


        


More information about the llvm-commits mailing list