[llvm] 213d489 - [test][GlobalOpt] Precommit more tests

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 18 19:38:02 PDT 2022


Author: Arthur Eubanks
Date: 2022-06-18T19:36:48-07:00
New Revision: 213d4897078b78faa33c9bedd01edb39c77d0aa3

URL: https://github.com/llvm/llvm-project/commit/213d4897078b78faa33c9bedd01edb39c77d0aa3
DIFF: https://github.com/llvm/llvm-project/commit/213d4897078b78faa33c9bedd01edb39c77d0aa3.diff

LOG: [test][GlobalOpt] Precommit more tests

And fix up existing tests to not have so much UB.

Added: 
    

Modified: 
    llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll b/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
index 88cd2a911c3d..e12b55021d14 100644
--- a/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
+++ b/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
@@ -1,10 +1,11 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
 
- at g1 = internal unnamed_addr global i1 false
- at g2 = internal unnamed_addr global i1 false
- at g3 = internal unnamed_addr global i1 false
- at g4 = internal unnamed_addr global i1 false
+ at g1 = internal unnamed_addr global i32 0
+ at g2 = internal unnamed_addr global i32 0
+ at g3 = internal unnamed_addr global i32 0
+ at g4 = internal unnamed_addr global i32 0
+ at g5 = internal unnamed_addr global i32 0
 
 declare void @b()
 
@@ -67,3 +68,27 @@ end:
   %r = load i1, ptr @g4
   ret i1 %r
 }
+
+define i1 @dom_multiple_function_loads() {
+; CHECK-LABEL: @dom_multiple_function_loads(
+; CHECK-NEXT:    store i1 true, ptr @g5, align 1
+; CHECK-NEXT:    call void @b()
+; CHECK-NEXT:    [[R:%.*]] = load i1, ptr @g5, align 1
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  store i1 true, ptr @g5
+  call void @b()
+  %r = load i1, ptr @g5
+  ret i1 %r
+}
+
+define i1 @other() {
+; CHECK-LABEL: @other(
+; CHECK-NEXT:    call void @b()
+; CHECK-NEXT:    [[R:%.*]] = load i1, ptr @g5, align 1
+; CHECK-NEXT:    ret i1 [[R]]
+;
+  call void @b()
+  %r = load i1, ptr @g5
+  ret i1 %r
+}


        


More information about the llvm-commits mailing list