[llvm] 44c9a26 - [Mem2Reg] Add tests with !noundef (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 06:35:56 PDT 2024
Author: Nikita Popov
Date: 2024-06-25T15:35:49+02:00
New Revision: 44c9a26756192228fd9dcd33c238ec8858d40329
URL: https://github.com/llvm/llvm-project/commit/44c9a26756192228fd9dcd33c238ec8858d40329
DIFF: https://github.com/llvm/llvm-project/commit/44c9a26756192228fd9dcd33c238ec8858d40329.diff
LOG: [Mem2Reg] Add tests with !noundef (NFC)
Added:
Modified:
llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll b/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll
index 73a68f26f4aed..e3c14cc662e2a 100644
--- a/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll
+++ b/llvm/test/Transforms/Mem2Reg/preserve-nonnull-load-metadata.ll
@@ -140,8 +140,41 @@ fin:
ret ptr null
}
-define ptr @no_store_single_load() {
-; CHECK-LABEL: @no_store_single_load(
+define ptr @no_store_single_load_noundef() {
+; CHECK-LABEL: @no_store_single_load_noundef(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret ptr undef
+;
+entry:
+ %buf = alloca ptr
+ %buf.load = load ptr, ptr %buf, !noundef !0
+ ret ptr %buf.load
+}
+
+define ptr @no_store_multiple_loads_noundef(i1 %c) {
+; CHECK-LABEL: @no_store_multiple_loads_noundef(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
+; CHECK: if:
+; CHECK-NEXT: ret ptr undef
+; CHECK: else:
+; CHECK-NEXT: ret ptr undef
+;
+entry:
+ %buf = alloca ptr
+ br i1 %c, label %if, label %else
+
+if:
+ %buf.load = load ptr, ptr %buf, !noundef !0
+ ret ptr %buf.load
+
+ else:
+ %buf.load2 = load ptr, ptr %buf, !noundef !0
+ ret ptr %buf.load2
+}
+
+define ptr @no_store_single_load_nonnull_noundef() {
+; CHECK-LABEL: @no_store_single_load_nonnull_noundef(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = icmp ne ptr undef, null
; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
@@ -153,8 +186,8 @@ entry:
ret ptr %buf.load
}
-define ptr @no_store_multiple_loads(i1 %c) {
-; CHECK-LABEL: @no_store_multiple_loads(
+define ptr @no_store_multiple_loads_nonnull_noundef(i1 %c) {
+; CHECK-LABEL: @no_store_multiple_loads_nonnull_noundef(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
; CHECK: if:
More information about the llvm-commits
mailing list