This patch renumbers the metadata nodes in debug info testcases after https://reviews.llvm.org/D26769. This is a separate patch because it causes so much churn. This was implemented with a python script that pipes the testcases through llvm-as - | llvm-dis - and then goes through the original and new output side-by side to insert all comments at a close-enough location.
Here's the script for reference:
import re, sys, subprocess fn = sys.argv[1] stdout = subprocess.check_output('llvm-as %s -o - | llvm-dis -o -' % fn, shell=True) new = stdout.split('\n') out = [] comment = re.compile(r'^([^;]*)(;.*)$') ws = re.compile(r'^ *$') empty = re.compile(r'^ *\n$') for line in open(fn): if new and new[0].startswith('; ModuleID ='): new = new[1:] # If there was a comment on this line, carry it over. m = comment.match(line) if m: if ws.match(m.group(1)): if m.group(2).startswith('; Function Attrs'): continue out.append(line) else: cmnt = m.group(2) if cmnt.startswith('; preds =') or cmnt.count(r'#uses='): cmnt = '' out.append(new[0]+' '+cmnt+'\n') new = new[1:] else: if empty.match(line): if out[-1] <> '\n': out.append('\n') continue # Try to sync the original and the new output again by comparing the # first couple of characters. if new: if new[0] == '' and out and out[-1] == '\n': new = new[1:] continue out.append(new[0]+'\n') new = new[1:] if len(new) > 2 and new[2][:8] == line[:8]: out.append(new[0]+'\n') new = new[1:] if len(new) > 1 and new[1][:8] == line[:8]: out.append(new[0]+'\n') new = new[1:] if len(new) > 0 and new[0][:8] == line[:8]: out.append(new[0]+'\n') new = new[1:] f = open(fn, 'w') f.write(''.join(out+new)+'\n')