[llvm] b3b049a - [Local] Preserve noundef metadata in copyMetadataForLoad()
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 07:56:17 PST 2023
Author: Nikita Popov
Date: 2023-01-19T16:56:09+01:00
New Revision: b3b049a824a09749e106ee477718a6145fe4c23f
URL: https://github.com/llvm/llvm-project/commit/b3b049a824a09749e106ee477718a6145fe4c23f
DIFF: https://github.com/llvm/llvm-project/commit/b3b049a824a09749e106ee477718a6145fe4c23f.diff
LOG: [Local] Preserve noundef metadata in copyMetadataForLoad()
If we're only changing the type of the load, preserve the noundef
metadata.
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 00cbee9a25e7..a57035d165ed 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2752,6 +2752,7 @@ void llvm::copyMetadataForLoad(LoadInst &Dest, const LoadInst &Source) {
case LLVMContext::MD_nontemporal:
case LLVMContext::MD_mem_parallel_loop_access:
case LLVMContext::MD_access_group:
+ case LLVMContext::MD_noundef:
// 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 5205b7d3f539..1ee3c3a25e22 100644
--- a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
+++ b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
@@ -165,7 +165,7 @@ entry:
define i32 @test_load_cast_combine_noundef(ptr %ptr) {
; CHECK-LABEL: @test_load_cast_combine_noundef(
-; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[PTR:%.*]], align 4
+; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[PTR:%.*]], align 4, !noundef !6
; CHECK-NEXT: ret i32 [[L1]]
;
%l = load float, ptr %ptr, !noundef !{}
More information about the llvm-commits
mailing list