[llvm] 207854b - [Local][InstCombine] Handle MD_noundef in combineMetadataCSE

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 02:09:44 PST 2023


Author: luxufan
Date: 2023-02-28T18:09:04+08:00
New Revision: 207854b07dd9bd0d79add49bc5af17f1aabc752f

URL: https://github.com/llvm/llvm-project/commit/207854b07dd9bd0d79add49bc5af17f1aabc752f
DIFF: https://github.com/llvm/llvm-project/commit/207854b07dd9bd0d79add49bc5af17f1aabc752f.diff

LOG: [Local][InstCombine] Handle MD_noundef in combineMetadataCSE

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D144942

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index febce5c8f9982..51e97e0d7909e 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2751,7 +2751,7 @@ void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J,
       LLVMContext::MD_dereferenceable,
       LLVMContext::MD_dereferenceable_or_null,
       LLVMContext::MD_access_group,    LLVMContext::MD_preserve_access_index,
-      LLVMContext::MD_nontemporal};
+      LLVMContext::MD_nontemporal,     LLVMContext::MD_noundef};
   combineMetadata(K, J, KnownIDs, KDominatesJ);
 }
 

diff  --git a/llvm/test/Transforms/InstCombine/load-combine-metadata.ll b/llvm/test/Transforms/InstCombine/load-combine-metadata.ll
index 61c37f8e7ffe1..c456d0f5ed21b 100644
--- a/llvm/test/Transforms/InstCombine/load-combine-metadata.ll
+++ b/llvm/test/Transforms/InstCombine/load-combine-metadata.ll
@@ -7,11 +7,12 @@ target datalayout = "e-m:e-p:64:64:64-i64:64-f80:128-n8:16:32:64-S128"
 ; CHECK: %[[V:.*]] = load i32, ptr %0
 ; CHECK-SAME: !tbaa !{{[0-9]+}}
 ; CHECK-SAME: !range ![[RANGE:[0-9]+]]
+; CHECK-SAME: !noundef !{{[0-9]+}}
 ; CHECK: store i32 %[[V]], ptr %1
 ; CHECK: store i32 %[[V]], ptr %2
 define void @test_load_load_combine_metadata(ptr, ptr, ptr) {
-  %a = load i32, ptr %0, !tbaa !8, !range !0, !alias.scope !5, !noalias !6
-  %b = load i32, ptr %0, !tbaa !8, !range !1
+  %a = load i32, ptr %0, !tbaa !8, !range !0, !noundef !10, !alias.scope !5, !noalias !6
+  %b = load i32, ptr %0, !tbaa !8, !range !1, !noundef !10
   store i32 %a, ptr %1
   store i32 %b, ptr %2
   ret void
@@ -28,3 +29,4 @@ define void @test_load_load_combine_metadata(ptr, ptr, ptr) {
 !7 = !{ !"tbaa root" }
 !8 = !{ !9, !9, i64 0 }
 !9 = !{ !"scalar type", !7}
+!10 = !{}


        


More information about the llvm-commits mailing list