[jit] Add a simple loop invariant loop motion pass for use with LLVM, which moves...
[mono.git] / mono / mini / arrays.cs
index f38d05319b2492b431dc551529aeadee3af821f7..55df1662c34358f3bf3fc345dec84b404e7e8a16 100644 (file)
@@ -791,6 +791,21 @@ class Tests
                        return 5;
                return 0;
        }
+
+       static int llvm_ldlen_licm (int[] arr) {
+               int sum = 0;
+               // The ldlen should be moved out of the loop
+               for (int i = 0; i < arr.Length; ++i)
+                       sum += arr [i];
+               return sum;
+       }
+
+       public static int test_10_llvm_ldlen_licm () {
+               int[] arr = new int [10];
+               for (int i = 0; i < 10; ++i)
+                       arr [i] = 1;
+               return llvm_ldlen_licm (arr);
+       }
 }