1import subprocess
2import sys
3
4opt = subprocess.run( [ 'opt', '-passes=print<loops>','-disable-output', sys.argv[1]], stdout=subprocess.PIPE, stderr=subprocess.PIPE )
5
6stdout = opt.stdout.decode()
7
8pattern = 'Loop at depth 1 containing'
9
10if (pattern in opt.stderr.decode()):
11  print('This is interesting!')
12  sys.exit(0)
13else:
14  print('This is NOT interesting!')
15  sys.exit(1)
16