[PATCH] D28759: [ExecutionDepsFix] Improve clearance calculation for loops
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 17 22:31:44 PDT 2017
MatzeB added a comment.
> Yes, I suppose it can grow with the number of nested loops. Must be quite a reproducer to cause this problem though. Unless of course there's something more fundamental wrong with the logic here (though for that I'd need the reproducer). In any case, it would be fine to change this to keep a working set in a SmallVector or something equivalent.
This is a recursion over the control flow graph and you only need a single loop. Recursing over the structure of the program is a no-go in a compiler as your stack is always limited and comparatively small and the input can grow arbitrarily.
We are seeing this in a real stage2 build of clang and we have to fix the buildbot! If you need to have a reproducer update llvm to r298184, limit your stack to 512kb (ulimit -s 512) as that is what is currently used by ThinLTO and use this python snippet to make a reproducer:
n_blocks=4000
print '''
---
name: func
tracksRegLiveness: true
body: |
bb.0:
successors: %bb.1, %bb.{n_blocks}
liveins: %xmm0
NOOP implicit %xmm0
JE_1 %bb.{n_blocks}, implicit undef %eflags
JMP_1 %bb.1
'''.format(**locals())
for i in range(1, n_blocks):
print ' bb.%s:' % (i)
if i < n_blocks-1:
print ' successors: %%bb.%s, %%bb.%s' % (i+1, n_blocks)
print ' JE_1 %%bb.%s, implicit undef %%eflags' % (i+1)
else:
print ' successors: %%bb.%s' % (n_blocks)
print ' JMP_1 %%bb.%s' % n_blocks
print '''
bb.{n_blocks}:
RETQ undef %eax
'''.format(**locals())
Repository:
rL LLVM
https://reviews.llvm.org/D28759
More information about the llvm-commits
mailing list