[PATCH] D144942: [Local][InstCombine] Handle MD_noundef in combineMetadataCSE

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 21:30:00 PST 2023


StephenFan created this revision.
StephenFan added a reviewer: nikic.
Herald added a subscriber: hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144942

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


Index: llvm/test/Transforms/InstCombine/load-combine-metadata.ll
===================================================================
--- llvm/test/Transforms/InstCombine/load-combine-metadata.ll
+++ llvm/test/Transforms/InstCombine/load-combine-metadata.ll
@@ -7,11 +7,12 @@
 ; 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 @@
 !7 = !{ !"tbaa root" }
 !8 = !{ !9, !9, i64 0 }
 !9 = !{ !"scalar type", !7}
+!10 = !{}
Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -2751,7 +2751,7 @@
       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);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144942.501023.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230228/daf82907/attachment.bin>


More information about the llvm-commits mailing list