Pythran compat - range vs. xrange
Use range instead of xrange whenever possible. The extra list creation in Python2
is generally not a performance bottleneck.
Differential Revision: https://reviews.llvm.org/D56253
llvm-svn: 350309
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-01.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-01.py
index e66042d..49ce623 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-01.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-01.py
@@ -79,7 +79,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bstop%d = getelementptr i32, i32 *%%stop, i64 %d' % (i, i))
@@ -90,14 +90,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%astop%d = getelementptr i32, i32 *%%stop, i64 %d' % (i, i + 25))
print(' %%acur%d = load i32 , i32 *%%astop%d' % (i, i))
print(' %%atest%d = icmp eq i32 %%limit, %%acur%d' % (i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-02.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-02.py
index 4566d97..155f742 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-02.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-02.py
@@ -66,7 +66,7 @@
print('')
a, b = 1, 1
-for i in xrange(blocks):
+for i in range(blocks):
a, b = b, a + b
value = a % 256
next = 'b%d' % (i + 1) if i + 1 < blocks else 'end'
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-03.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-03.py
index 16fcbe7..f58bedf 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-03.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-03.py
@@ -79,7 +79,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bstop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i))
@@ -91,14 +91,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%astop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i + 25))
print(' %%acur%d = load i8 , i8 *%%astop%d' % (i, i))
print(' %%aext%d = sext i8 %%acur%d to i32' % (i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-04.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-04.py
index 2b22f75..6aca0a2 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-04.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-04.py
@@ -83,7 +83,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bstop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i))
@@ -95,14 +95,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%astop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i + 25))
print(' %%acur%d = load i8 , i8 *%%astop%d' % (i, i))
print(' %%aext%d = sext i8 %%acur%d to i64' % (i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-05.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-05.py
index 8f85a32..326fe8b 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-05.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-05.py
@@ -83,7 +83,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bcur%d = load i8 , i8 *%%stop' % i)
@@ -94,14 +94,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%acur%d = load i8 , i8 *%%stop' % i)
print(' %%aext%d = sext i8 %%acur%d to i32' % (i, i))
print(' %%atest%d = icmp slt i32 %%aext%d, %d' % (i, i, i + 100))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-06.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-06.py
index 7f1fce3..44cc5c6 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-06.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-06.py
@@ -83,7 +83,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bcur%d = load i8 , i8 *%%stop' % i)
@@ -94,14 +94,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%acur%d = load i8 , i8 *%%stop' % i)
print(' %%aext%d = sext i8 %%acur%d to i64' % (i, i))
print(' %%atest%d = icmp slt i64 %%aext%d, %d' % (i, i, i + 100))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-07.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-07.py
index 03764c6..71e9588 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-07.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-07.py
@@ -40,7 +40,7 @@
print('define void @f1(i8 *%base, i32 *%counts) {')
print('entry:')
-for i in xrange(branch_blocks - 1, -1, -1):
+for i in range(branch_blocks - 1, -1, -1):
print(' %%countptr%d = getelementptr i32, i32 *%%counts, i64 %d' % (i, i))
print(' %%initcount%d = load i32 , i32 *%%countptr%d' % (i, i))
print(' br label %%loop%d' % i)
@@ -52,14 +52,14 @@
' [ %%nextcount%d, %%%s ]' % (i, i, block1, i, block2)))
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%nextcount%d = add i32 %%count%d, -1' % (i, i))
print(' %%test%d = icmp ne i32 %%nextcount%d, 0' % (i, i))
print(' br i1 %%test%d, label %%loop%d, label %%after%d' % (i, i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-08.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-08.py
index 56e3901..2ef6859 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-08.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-08.py
@@ -41,7 +41,7 @@
print('define void @f1(i8 *%base, i64 *%counts) {')
print('entry:')
-for i in xrange(branch_blocks - 1, -1, -1):
+for i in range(branch_blocks - 1, -1, -1):
print(' %%countptr%d = getelementptr i64, i64 *%%counts, i64 %d' % (i, i))
print(' %%initcount%d = load i64 , i64 *%%countptr%d' % (i, i))
print(' br label %%loop%d' % i)
@@ -53,14 +53,14 @@
' [ %%nextcount%d, %%%s ]' % (i, i, block1, i, block2)))
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%nextcount%d = add i64 %%count%d, -1' % (i, i))
print(' %%test%d = icmp ne i64 %%nextcount%d, 0' % (i, i))
print(' br i1 %%test%d, label %%loop%d, label %%after%d' % (i, i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-09.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-09.py
index 40bfe31..09d5d69 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-09.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-09.py
@@ -79,7 +79,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bstop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i))
@@ -91,14 +91,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%astop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i + 25))
print(' %%acur%d = load i8 , i8 *%%astop%d' % (i, i))
print(' %%aext%d = sext i8 %%acur%d to i32' % (i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-10.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-10.py
index 0adcaa4..258989b 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-10.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-10.py
@@ -83,7 +83,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bstop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i))
@@ -95,14 +95,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%astop%d = getelementptr i8, i8 *%%stop, i64 %d' % (i, i + 25))
print(' %%acur%d = load i8 , i8 *%%astop%d' % (i, i))
print(' %%aext%d = sext i8 %%acur%d to i64' % (i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-11.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-11.py
index f553b35..22776aa 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-11.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-11.py
@@ -99,7 +99,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bcur%da = load i32 , i32 *%%stopa' % i)
@@ -111,14 +111,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%acur%da = load i32 , i32 *%%stopa' % i)
print(' %%acur%db = load i32 , i32 *%%stopb' % i)
print(' %%asub%d = sub i32 %%acur%da, %%acur%db' % (i, i, i))
diff --git a/llvm/test/CodeGen/SystemZ/Large/branch-range-12.py b/llvm/test/CodeGen/SystemZ/Large/branch-range-12.py
index 1cedc6d..0911953 100644
--- a/llvm/test/CodeGen/SystemZ/Large/branch-range-12.py
+++ b/llvm/test/CodeGen/SystemZ/Large/branch-range-12.py
@@ -99,7 +99,7 @@
print(' br label %before0')
print('')
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
next = 'before%d' % (i + 1) if i + 1 < branch_blocks else 'main'
print('before%d:' % i)
print(' %%bcur%da = load i64 , i64 *%%stopa' % i)
@@ -111,14 +111,14 @@
print('%s:' % next)
a, b = 1, 1
-for i in xrange(0, main_size, 6):
+for i in range(0, main_size, 6):
a, b = b, a + b
offset = 4096 + b % 500000
value = a % 256
print(' %%ptr%d = getelementptr i8, i8 *%%base, i64 %d' % (i, offset))
print(' store volatile i8 %d, i8 *%%ptr%d' % (value, i))
-for i in xrange(branch_blocks):
+for i in range(branch_blocks):
print(' %%acur%da = load i64 , i64 *%%stopa' % i)
print(' %%acur%db = load i64 , i64 *%%stopb' % i)
print(' %%asub%d = sub i64 %%acur%da, %%acur%db' % (i, i, i))