[llvm] 61a96e5 - [NFC] Precommit a coroutine test for LoopRotate (#82031)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 14:47:36 PST 2024


Author: Alan Zhao
Date: 2024-02-19T14:47:32-08:00
New Revision: 61a96e5afadd034e7d13126f0e43731bbad7ad89

URL: https://github.com/llvm/llvm-project/commit/61a96e5afadd034e7d13126f0e43731bbad7ad89
DIFF: https://github.com/llvm/llvm-project/commit/61a96e5afadd034e7d13126f0e43731bbad7ad89.diff

LOG: [NFC] Precommit a coroutine test for LoopRotate (#82031)

This is to provide a baseline test for
https://github.com/llvm/llvm-project/pull/81937.

Added: 
    llvm/test/Transforms/LoopRotate/coroutine.ll

Modified: 
    

Removed: 
    


################################################################################
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