[llvm] 07b9937 - [test][GlobalOpt] Precommit test
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 18 15:44:50 PDT 2022
Author: Arthur Eubanks
Date: 2022-06-18T15:44:27-07:00
New Revision: 07b9937d0c5373a51fa24bf6b3efd8d7d74de050
URL: https://github.com/llvm/llvm-project/commit/07b9937d0c5373a51fa24bf6b3efd8d7d74de050
DIFF: https://github.com/llvm/llvm-project/commit/07b9937d0c5373a51fa24bf6b3efd8d7d74de050.diff
LOG: [test][GlobalOpt] Precommit test
Added:
llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll b/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
new file mode 100644
index 0000000000000..88cd2a911c3d3
--- /dev/null
+++ b/llvm/test/Transforms/GlobalOpt/stored-once-forward-value.ll
@@ -0,0 +1,69 @@
+; 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
+
+declare void @b()
+
+define i1 @dom_const() {
+; CHECK-LABEL: @dom_const(
+; CHECK-NEXT: store i1 true, ptr @g1, align 1
+; CHECK-NEXT: call void @b()
+; CHECK-NEXT: [[R:%.*]] = load i1, ptr @g1, align 1
+; CHECK-NEXT: ret i1 [[R]]
+;
+ store i1 true, ptr @g1
+ call void @b()
+ %r = load i1, ptr @g1
+ ret i1 %r
+}
+
+define i32 @dom_arg(i32 %a) {
+; CHECK-LABEL: @dom_arg(
+; CHECK-NEXT: store i32 [[A:%.*]], ptr @g2, align 4
+; CHECK-NEXT: call void @b()
+; CHECK-NEXT: [[R:%.*]] = load i32, ptr @g2, align 4
+; CHECK-NEXT: ret i32 [[R]]
+;
+ store i32 %a, ptr @g2
+ call void @b()
+ %r = load i32, ptr @g2
+ ret i32 %r
+}
+
+define i32 @dom_
diff erent_types() {
+; CHECK-LABEL: @dom_
diff erent_types(
+; CHECK-NEXT: store i1 true, ptr @g3, align 1
+; CHECK-NEXT: call void @b()
+; CHECK-NEXT: [[R:%.*]] = load i32, ptr @g3, align 4
+; CHECK-NEXT: ret i32 [[R]]
+;
+ store i1 true, ptr @g3
+ call void @b()
+ %r = load i32, ptr @g3
+ ret i32 %r
+}
+
+define i1 @no_dom(i1 %i) {
+; CHECK-LABEL: @no_dom(
+; CHECK-NEXT: br i1 [[I:%.*]], label [[BB1:%.*]], label [[END:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: store i1 true, ptr @g4, align 1
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: call void @b()
+; CHECK-NEXT: [[R:%.*]] = load i1, ptr @g4, align 1
+; CHECK-NEXT: ret i1 [[R]]
+;
+ br i1 %i, label %bb1, label %end
+bb1:
+ store i1 true, ptr @g4
+ br label %end
+end:
+ call void @b()
+ %r = load i1, ptr @g4
+ ret i1 %r
+}
More information about the llvm-commits
mailing list