[llvm] 0e11a7e - [EarlyCSE] Add test with noundef load of undef (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 08:11:01 PDT 2024


Author: Nikita Popov
Date: 2024-06-25T17:10:43+02:00
New Revision: 0e11a7e7179a2eb066e5f63f25b9277aa63f38eb

URL: https://github.com/llvm/llvm-project/commit/0e11a7e7179a2eb066e5f63f25b9277aa63f38eb
DIFF: https://github.com/llvm/llvm-project/commit/0e11a7e7179a2eb066e5f63f25b9277aa63f38eb.diff

LOG: [EarlyCSE] Add test with noundef load of undef (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/EarlyCSE/flags.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/EarlyCSE/flags.ll b/llvm/test/Transforms/EarlyCSE/flags.ll
index 78282b081c298..78b3818b211da 100644
--- a/llvm/test/Transforms/EarlyCSE/flags.ll
+++ b/llvm/test/Transforms/EarlyCSE/flags.ll
@@ -51,7 +51,7 @@ define void @test_inbounds_program_not_ub_if_first_gep_poison(ptr %ptr, i64 %n)
 
 define void @load_both_nonnull(ptr %p) {
 ; CHECK-LABEL: @load_both_nonnull(
-; CHECK-NEXT:    [[V1:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull !0
+; CHECK-NEXT:    [[V1:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull [[META0:![0-9]+]]
 ; CHECK-NEXT:    call void @use.ptr(ptr [[V1]])
 ; CHECK-NEXT:    call void @use.ptr(ptr [[V1]])
 ; CHECK-NEXT:    ret void
@@ -79,7 +79,7 @@ define void @load_first_nonnull(ptr %p) {
 
 define void @load_first_nonnull_noundef(ptr %p) {
 ; CHECK-LABEL: @load_first_nonnull_noundef(
-; CHECK-NEXT:    [[V1:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull !0, !noundef !0
+; CHECK-NEXT:    [[V1:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull [[META0]], !noundef [[META0]]
 ; CHECK-NEXT:    call void @use.ptr(ptr [[V1]])
 ; CHECK-NEXT:    call void @use.ptr(ptr [[V1]])
 ; CHECK-NEXT:    ret void
@@ -93,7 +93,7 @@ define void @load_first_nonnull_noundef(ptr %p) {
 
 define ptr @store_to_load_forward(ptr %p, ptr %p2) {
 ; CHECK-LABEL: @store_to_load_forward(
-; CHECK-NEXT:    [[P3:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull !0
+; CHECK-NEXT:    [[P3:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull [[META0]]
 ; CHECK-NEXT:    store ptr [[P3]], ptr [[P2:%.*]], align 8
 ; CHECK-NEXT:    ret ptr [[P3]]
 ;
@@ -102,3 +102,13 @@ define ptr @store_to_load_forward(ptr %p, ptr %p2) {
   %res = load ptr, ptr %p2
   ret ptr %res
 }
+
+define i32 @load_undef_noundef(ptr %p) {
+; CHECK-LABEL: @load_undef_noundef(
+; CHECK-NEXT:    store i32 undef, ptr [[P:%.*]], align 4
+; CHECK-NEXT:    ret i32 undef
+;
+  store i32 undef, ptr %p
+  %v = load i32, ptr %p, !noundef !{}
+  ret i32 %v
+}


        


More information about the llvm-commits mailing list