diff options
| author | 2026-02-18 18:17:14 +0100 | |
|---|---|---|
| committer | 2026-02-18 18:19:11 +0100 | |
| commit | 0b90de2e773f439fa606ddf2bc403d2f42fa4c3d (patch) | |
| tree | 2b7b6600d8bbbe08735c1f2d6d3e6b2885c0e5e0 /test | |
| parent | 886fdfe8c856ee778103661b832b28cf3e6aed7e (diff) | |
ir: basic inlining pass implementation
Diffstat (limited to 'test')
| -rw-r--r-- | test/16-inline.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/16-inline.c b/test/16-inline.c new file mode 100644 index 0000000..983d9b2 --- /dev/null +++ b/test/16-inline.c @@ -0,0 +1,22 @@ + +/* CFLAGS: -O1 */ +/* EXPECT: +25;0 +*/ + +static inline int sqr(int x) {return x*x;} +static inline int foo(int); +static inline int ind(int (*f)(int), int arg) { + return f(arg); +} + +#include <stdio.h> +int main() { + int q = ind(sqr, 5); + printf("%d;%d\n", q, ind(foo,-2)); +} + +static inline int foo(int w) { + return w+2; +} + |