[llvm] r350309 - Pythran compat - range vs. xrange
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 06:11:58 PST 2019
Author: serge_sans_paille
Date: Thu Jan 3 06:11:58 2019
New Revision: 350309
URL: http://llvm.org/viewvc/llvm-project?rev=350309&view=rev
Log:
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
Modified:
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-01.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-02.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-03.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-04.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-05.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-06.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-07.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-08.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-09.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-10.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-11.py
llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-12.py
llvm/trunk/utils/create_ladder_graph.py
llvm/trunk/utils/shuffle_fuzz.py
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-01.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-01.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-01.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-01.py Thu Jan 3 06:11:58 2019
@@ -79,7 +79,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-02.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-02.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-02.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-02.py Thu Jan 3 06:11:58 2019
@@ -66,7 +66,7 @@ print(' br label %b0')
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'
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-03.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-03.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-03.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-03.py Thu Jan 3 06:11:58 2019
@@ -79,7 +79,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-04.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-04.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-04.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-04.py Thu Jan 3 06:11:58 2019
@@ -83,7 +83,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-05.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-05.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-05.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-05.py Thu Jan 3 06:11:58 2019
@@ -83,7 +83,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-06.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-06.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-06.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-06.py Thu Jan 3 06:11:58 2019
@@ -83,7 +83,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-07.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-07.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-07.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-07.py Thu Jan 3 06:11:58 2019
@@ -40,7 +40,7 @@ main_size = 0xffd8
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 @@ for i in xrange(branch_blocks - 1, -1, -
' [ %%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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-08.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-08.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-08.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-08.py Thu Jan 3 06:11:58 2019
@@ -41,7 +41,7 @@ main_size = 0xffd8
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 @@ for i in xrange(branch_blocks - 1, -1, -
' [ %%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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-09.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-09.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-09.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-09.py Thu Jan 3 06:11:58 2019
@@ -79,7 +79,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-10.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-10.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-10.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-10.py Thu Jan 3 06:11:58 2019
@@ -83,7 +83,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-11.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-11.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-11.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-11.py Thu Jan 3 06:11:58 2019
@@ -99,7 +99,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-12.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-12.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-12.py (original)
+++ llvm/trunk/test/CodeGen/SystemZ/Large/branch-range-12.py Thu Jan 3 06:11:58 2019
@@ -99,7 +99,7 @@ print('entry:')
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 @@ for i in xrange(branch_blocks):
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))
Modified: llvm/trunk/utils/create_ladder_graph.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/create_ladder_graph.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/utils/create_ladder_graph.py (original)
+++ llvm/trunk/utils/create_ladder_graph.py Thu Jan 3 06:11:58 2019
@@ -22,8 +22,8 @@ def main():
print("Rungs must be a multiple of 2")
return
print("int ladder(int *foo, int *bar, int x) {")
- rung1 = xrange(0, args.rungs, 2)
- rung2 = xrange(1, args.rungs, 2)
+ rung1 = range(0, args.rungs, 2)
+ rung2 = range(1, args.rungs, 2)
for i in rung1:
print("rung1%d:" % i)
print("*foo = x++;")
Modified: llvm/trunk/utils/shuffle_fuzz.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/shuffle_fuzz.py?rev=350309&r1=350308&r2=350309&view=diff
==============================================================================
--- llvm/trunk/utils/shuffle_fuzz.py (original)
+++ llvm/trunk/utils/shuffle_fuzz.py Thu Jan 3 06:11:58 2019
@@ -107,7 +107,7 @@ def main():
else random.choice(range(shuffle_range))
for _ in itertools.repeat(None, width)]
for _ in itertools.repeat(None, args.max_shuffle_height - i)]
- for i in xrange(args.max_shuffle_height)]
+ for i in range(args.max_shuffle_height)]
if args.verbose:
# Print out the shuffle sequence in a compact form.
@@ -121,8 +121,8 @@ def main():
# Symbolically evaluate the shuffle tree.
inputs = [[int(j % element_modulus)
- for j in xrange(i * width + 1, (i + 1) * width + 1)]
- for i in xrange(args.max_shuffle_height + 1)]
+ for j in range(i * width + 1, (i + 1) * width + 1)]
+ for i in range(args.max_shuffle_height + 1)]
results = inputs
for shuffles in shuffle_tree:
results = [[((results[i] if j < width else results[i + 1])[j % width]
@@ -157,7 +157,7 @@ define internal fastcc <%(N)d x %(T)s> @
entry:""" % dict(subst,
arguments=', '.join(
['<%(N)d x %(T)s> %%s.0.%(i)d' % dict(subst, i=i)
- for i in xrange(args.max_shuffle_height + 1)])))
+ for i in range(args.max_shuffle_height + 1)])))
for i, shuffles in enumerate(shuffle_tree):
for j, s in enumerate(shuffles):
@@ -191,7 +191,7 @@ define internal fastcc <%(N)d x %(T)s> @
}
""" % dict(subst,
arguments=', '.join(['<%(N)d x %(T)s> %%s.%(i)d' % dict(subst, i=i)
- for i in xrange(args.max_shuffle_height + 1)])))
+ for i in range(args.max_shuffle_height + 1)])))
# Finally, generate a main function which will trap if any lanes are mapped
# incorrectly (in an observable way).
More information about the llvm-commits
mailing list