[cfe-commits] r134442 - /cfe/trunk/test/CodeGen/debug-info-iv.c

Devang Patel dpatel at apple.com
Tue Jul 5 14:48:46 PDT 2011


Author: dpatel
Date: Tue Jul  5 16:48:46 2011
New Revision: 134442

URL: http://llvm.org/viewvc/llvm-project?rev=134442&view=rev
Log:
Testcase for r134441.

Added:
    cfe/trunk/test/CodeGen/debug-info-iv.c

Added: cfe/trunk/test/CodeGen/debug-info-iv.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-iv.c?rev=134442&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-iv.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-iv.c Tue Jul  5 16:48:46 2011
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -Os -S -g  -o - %s | FileCheck %s
+
+int calculate(int);
+static void test_indvars(int *Array1, int Array2[100][200]) {
+  unsigned i, j;
+  Array1[1] = Array2[3][6] = 12345;
+
+  for (i = 0; i < 100; i+=2)
+    Array1[i] = i;           /* Step by non unit amount */
+
+  for (i = 3; i < 103; i++)
+    Array1[i] = i+4;         /* Step with an offset */
+
+  for (i = 13; i < 100; i++)
+    for (j = 0; j < 100; j+=3)       /* 2d array access */
+      Array2[i][j/3] = Array2[i][i];
+} 
+
+
+int main() {
+  int Array[100][200], i, j;
+  double sum = 0.0;
+  
+  for (i=0; i < 100; i+=2)
+    for (j=0; j < 200; j++)
+      Array[i][j] = 0;
+  test_indvars(Array[0], Array);
+
+//CHECK:	.loc	2 30 3
+  for (i=0; i < 100; i+=2)
+    for (j=0; j < 200; j++)
+      sum += Array[i][j];
+  
+  return calculate(sum);
+}





More information about the cfe-commits mailing list