[llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 11 22:27:19 PDT 2004
Changes in directory llvm/test/Programs/SingleSource/Regression/C:
2004-08-12-InlinerAndAllocas.c added (r1.1)
---
Log message:
New testcase
---
Diffs of the changes: (+21 -0)
Index: llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c
diff -c /dev/null llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c:1.1
*** /dev/null Thu Aug 12 00:27:19 2004
--- llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c Thu Aug 12 00:27:09 2004
***************
*** 0 ****
--- 1,21 ----
+ // A compiler cannot inline Callee into main unless it is prepared to reclaim
+ // the stack memory allocated in it.
+
+ #include <alloca.h>
+ #include <stdio.h>
+
+ static int Callee(int i) {
+ if (i != 0) {
+ char *X = alloca(1000);
+ sprintf(X, "%d\n", i);
+ return X[0];
+ }
+ return 0;
+ }
+
+ int main() {
+ int i, j = 0;
+ for (i = 0; i < 10000; ++i)
+ j += Callee(i);
+ printf("%d\n", j);
+ }
More information about the llvm-commits
mailing list