llvm-project/llvm/test/tools/llvm-reduce/remove-bbs-sequence.py
Markus Lavin bb8e02325f llvm-reduce: improve basic-blocks removal pass
When the single branch target of a block has been removed try updating
it to target a  block that is kept (by scanning forward in the sequence)
instead of replacing the branch with a return instruction. Doing so
reduces the risk of breaking loop structures meaning that when the loop
is 'interesting' these reductions should have more blocks eliminated.

Differential Revision: https://reviews.llvm.org/D125766
2022-05-24 09:51:25 +02:00

16 lines
376 B
Python
Executable File

import subprocess
import sys
opt = subprocess.run( [ 'opt', '-passes=print<loops>','-disable-output', sys.argv[1]], stdout=subprocess.PIPE, stderr=subprocess.PIPE )
stdout = opt.stdout.decode()
pattern = 'Loop at depth 1 containing'
if (pattern in opt.stderr.decode()):
print('This is interesting!')
sys.exit(0)
else:
print('This is NOT interesting!')
sys.exit(1)