aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@meta.com>2025-03-31 08:45:43 -0700
committerKyungwoo Lee <kyulee@meta.com>2025-03-31 08:47:20 -0700
commit5014178d552a88752127d3b7629770a5e94b2ba4 (patch)
tree49ce15a0e0bd37c61dc327e321abe233f8409f78
parent232f180b956c085dbed4feb7514f8110ad4bb2af (diff)
downloadllvm-users/kyulee-com/inline1.zip
llvm-users/kyulee-com/inline1.tar.gz
llvm-users/kyulee-com/inline1.tar.bz2
-rw-r--r--llvm/tools/inline1/CMakeLists.txt12
-rw-r--r--llvm/tools/inline1/t1.c13
-rw-r--r--llvm/tools/inline1/t2.c11
-rw-r--r--llvm/tools/inline1/t3.c9
4 files changed, 45 insertions, 0 deletions
diff --git a/llvm/tools/inline1/CMakeLists.txt b/llvm/tools/inline1/CMakeLists.txt
new file mode 100644
index 0000000..4415429
--- /dev/null
+++ b/llvm/tools/inline1/CMakeLists.txt
@@ -0,0 +1,12 @@
+set(LLVM_LINK_COMPONENTS
+ Core
+ )
+
+add_llvm_tool(inline1
+ t1.c
+ t2.c
+ t3.c
+
+ DEPENDS
+ intrinsics_gen
+ )
diff --git a/llvm/tools/inline1/t1.c b/llvm/tools/inline1/t1.c
new file mode 100644
index 0000000..b58c608
--- /dev/null
+++ b/llvm/tools/inline1/t1.c
@@ -0,0 +1,13 @@
+#ifdef ALWAYS_INLINE
+__attribute__((always_inline))
+#endif
+int foo(int a, int b) {
+ int s= 0;
+ for(int i = a; i < b; ++i)
+ s+=i;
+ return s*3;
+}
+
+int small(int a) {
+ return a + 3;
+}
diff --git a/llvm/tools/inline1/t2.c b/llvm/tools/inline1/t2.c
new file mode 100644
index 0000000..e2875eb
--- /dev/null
+++ b/llvm/tools/inline1/t2.c
@@ -0,0 +1,11 @@
+int foo(int a, int b);
+int small(int);
+
+int goo(int c, int d) {
+ int s= 0;
+ for(int i = c; i < d; ++i)
+ s+=foo(i, d);
+ for(int i = c*s; i < d*s*3; ++i)
+ s+=i*3 + small(i);
+ return s;
+}
diff --git a/llvm/tools/inline1/t3.c b/llvm/tools/inline1/t3.c
new file mode 100644
index 0000000..e138890
--- /dev/null
+++ b/llvm/tools/inline1/t3.c
@@ -0,0 +1,9 @@
+int foo(int a, int b);
+int goo(int a, int b);
+int small(int);
+
+int main() {
+ int s = small(3);
+ s =+ goo(3,2)* goo(5,1) * small(s*2);
+ return foo(s, s+1)- small(s+3);
+}