diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-05-18 21:44:03 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-05-18 21:44:03 -0700 |
commit | 0641c3f9d7bc19e2745e3f08ba6c3f7dc96eb362 (patch) | |
tree | ec4efb05201e5416ec1e0dc82d75ed234cb405cc /tools | |
parent | 8a0ad7206459a5bfb4080354db0958de6a8378ec (diff) |
fixes for dfe
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/dead_function_eliminator.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/dead_function_eliminator.py b/tools/dead_function_eliminator.py index a694ce05..d6f96536 100755 --- a/tools/dead_function_eliminator.py +++ b/tools/dead_function_eliminator.py @@ -47,7 +47,7 @@ for i in range(len(lines)): for ident in functions.iterkeys(): func = functions[ident] - print ident + #print ident if '@main' not in functions: print 'No @main found, not running DFE' @@ -84,7 +84,7 @@ functions['@main'].callers.add('GLOBAL') for ident in functions.iterkeys(): func = functions[ident] - print ident, func.uses, func.callers#, 'WARNING!' if func.uses != len(func.callers) else '' + #print ident, func.uses, func.callers#, 'WARNING!' if func.uses != len(func.callers) else '' # Garbage collect @@ -96,7 +96,7 @@ for ident in functions.iterkeys(): for caller in func.callers: if caller == 'GLOBAL': func.root = True - print 'ROOT:', ident + #print 'ROOT:', ident break def mark_and_recurse(func): @@ -115,7 +115,7 @@ marked = unmarked = 0 for ident in functions.iterkeys(): func = functions[ident] if func.root: assert func.marked - print ident, func.marked + #print ident, func.marked marked += func.marked unmarked += 1-func.marked @@ -157,7 +157,8 @@ for line in lines: ######### if metadata.match(line): continue # metadata is not enough to keep things alive if line.startswith('!llvm.dbg.sp = '): continue if not inside or marked: - target.write(line + '\n') + if len(line) > 0: + target.write(line + '\n') target.close() |