[llvm] [NFC] Precommit a coroutine test for LoopRotate (PR #82031)
Alan Zhao via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 14:47:11 PST 2024
https://github.com/alanzhao1 updated https://github.com/llvm/llvm-project/pull/82031
>From a5e15708e2c898aef225c91cc85e0235c0aa5bdb Mon Sep 17 00:00:00 2001
From: Alan Zhao <ayzhao at google.com>
Date: Fri, 16 Feb 2024 11:28:03 -0800
Subject: [PATCH] [NFC] Precommit a coroutine test for LoopRotate
This is to provide a baseline test for
https://github.com/llvm/llvm-project/pull/81937.
---
llvm/test/Transforms/LoopRotate/coroutine.ll | 45 ++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 llvm/test/Transforms/LoopRotate/coroutine.ll
diff --git a/llvm/test/Transforms/LoopRotate/coroutine.ll b/llvm/test/Transforms/LoopRotate/coroutine.ll
new file mode 100644
index 00000000000000..9d7bf595e21cdc
--- /dev/null
+++ b/llvm/test/Transforms/LoopRotate/coroutine.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -S -passes=loop-rotate < %s | FileCheck %s
+
+declare void @bar()
+
+ at threadlocalint = thread_local global i32 0, align 4
+
+define void @foo() #0 {
+; CHECK-LABEL: define void @foo(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @threadlocalint)
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
+; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[CMP1]], label [[COND_END_LR_PH:%.*]], label [[COND_FALSE:%.*]]
+; CHECK: cond.end.lr.ph:
+; CHECK-NEXT: br label [[COND_END:%.*]]
+; CHECK: while.cond.cond.false_crit_edge:
+; CHECK-NEXT: br label [[COND_FALSE]]
+; CHECK: cond.false:
+; CHECK-NEXT: ret void
+; CHECK: cond.end:
+; CHECK-NEXT: call void @bar()
+; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP2]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[COND_END]], label [[WHILE_COND_COND_FALSE_CRIT_EDGE:%.*]]
+;
+entry:
+ br label %while.cond
+
+while.cond:
+ %1 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @threadlocalint)
+ %2 = load i32, ptr %1, align 4
+ %cmp = icmp eq i32 %2, 0
+ br i1 %cmp, label %cond.end, label %cond.false
+
+cond.false:
+ ret void
+
+cond.end:
+ call void @bar()
+ br label %while.cond
+}
+
+attributes #0 = { presplitcoroutine }
More information about the llvm-commits
mailing list