[llvm] 5fc8a19 - [LoongArch] Pre commit test for #88371. NFC
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 03:00:57 PDT 2024
Author: wanglei
Date: 2024-04-12T17:57:28+08:00
New Revision: 5fc8a190b37906cba3f175440abd79dabd8acc73
URL: https://github.com/llvm/llvm-project/commit/5fc8a190b37906cba3f175440abd79dabd8acc73
DIFF: https://github.com/llvm/llvm-project/commit/5fc8a190b37906cba3f175440abd79dabd8acc73.diff
LOG: [LoongArch] Pre commit test for #88371. NFC
Added:
llvm/test/Transforms/CodeGenPrepare/LoongArch/lit.local.cfg
llvm/test/Transforms/CodeGenPrepare/LoongArch/splitgep.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CodeGenPrepare/LoongArch/lit.local.cfg b/llvm/test/Transforms/CodeGenPrepare/LoongArch/lit.local.cfg
new file mode 100644
index 00000000000000..cc24278acbb414
--- /dev/null
+++ b/llvm/test/Transforms/CodeGenPrepare/LoongArch/lit.local.cfg
@@ -0,0 +1,2 @@
+if not "LoongArch" in config.root.targets:
+ config.unsupported = True
diff --git a/llvm/test/Transforms/CodeGenPrepare/LoongArch/splitgep.ll b/llvm/test/Transforms/CodeGenPrepare/LoongArch/splitgep.ll
new file mode 100644
index 00000000000000..ca2a16a0ca7ecd
--- /dev/null
+++ b/llvm/test/Transforms/CodeGenPrepare/LoongArch/splitgep.ll
@@ -0,0 +1,34 @@
+; RUN: opt --mtriple=loongarch64 -S --passes='require<profile-summary>,function(codegenprepare)' %s | FileCheck %s
+
+; Check that we have deterministic output
+define void @test(ptr %sp, ptr %t, i32 %n) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: %s = load ptr, ptr %sp, align 8
+; CHECK-NEXT: br label %while_cond
+
+entry:
+ %s = load ptr, ptr %sp
+ br label %while_cond
+
+while_cond:
+ %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
+ %gep0 = getelementptr [65536 x i32], ptr %s, i64 0, i64 20000
+ %gep1 = getelementptr [65536 x i32], ptr %s, i64 0, i64 20001
+ %gep2 = getelementptr [65536 x i32], ptr %t, i64 0, i64 20000
+ %gep3 = getelementptr [65536 x i32], ptr %t, i64 0, i64 20001
+ %cmp = icmp slt i32 %phi, %n
+ br i1 %cmp, label %while_body, label %while_end
+
+while_body:
+ %i = add i32 %phi, 1
+ store i32 %i, ptr %gep0
+ store i32 %phi, ptr %gep1
+ store i32 %i, ptr %gep2
+ store i32 %phi, ptr %gep3
+ br label %while_cond
+
+while_end:
+ ret void
+}
+
More information about the llvm-commits
mailing list