[llvm] 3ea86a1 - [Sink] Add a single successor test
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 17 00:12:49 PST 2022
Author: Fangrui Song
Date: 2022-11-17T00:12:42-08:00
New Revision: 3ea86a13f4d1301fa27ef503f03a8d4abdc133af
URL: https://github.com/llvm/llvm-project/commit/3ea86a13f4d1301fa27ef503f03a8d4abdc133af
DIFF: https://github.com/llvm/llvm-project/commit/3ea86a13f4d1301fa27ef503f03a8d4abdc133af.diff
LOG: [Sink] Add a single successor test
Added:
llvm/test/Transforms/Sink/single-succ.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Sink/single-succ.ll b/llvm/test/Transforms/Sink/single-succ.ll
new file mode 100644
index 000000000000..c3473181a472
--- /dev/null
+++ b/llvm/test/Transforms/Sink/single-succ.ll
@@ -0,0 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S < %s -passes=sink | FileCheck %s
+
+define i32 @single_succ(i1 %b, ptr %a) {
+; CHECK-LABEL: @single_succ(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[L:%.*]] = load i32, ptr [[A:%.*]], align 4
+; CHECK-NEXT: br label [[IF:%.*]]
+; CHECK: if:
+; CHECK-NEXT: br i1 [[B:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
+; CHECK: then:
+; CHECK-NEXT: ret i32 42
+; CHECK: else:
+; CHECK-NEXT: ret i32 [[L]]
+;
+entry:
+ %l = load i32, ptr %a, align 4
+ br label %if
+if:
+ br i1 %b, label %then, label %else
+then:
+ ret i32 42
+else:
+ ret i32 %l
+}
More information about the llvm-commits
mailing list