<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I’ll fix it up now.<div><br></div><div>Michael</div><div><br></div><div><div><div>On Aug 2, 2014, at 3:51 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p dir="ltr">Some documentation with examples probably wouldn't go amiss. :)</p><p dir="ltr">Script looks fun though. </p><p dir="ltr">-eric</p>
<div class="gmail_quote">On Aug 1, 2014 6:50 PM, "Michael Gottesman" <<a href="mailto:mgottesman@apple.com">mgottesman@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: mgottesman<br>
Date: Fri Aug  1 20:39:08 2014<br>
New Revision: 214610<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=214610&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=214610&view=rev</a><br>
Log:<br>
Add a small utility called bisect that enables commandline bisecting on a counter.<br>
<br>
This is something that I have found to be very useful in my work and I<br>
wanted to contribute it back to the community since several people in<br>
the past have asked me for something along these lines. (Jakob, I know<br>
this has been a while coming ; )]<br>
<br>
The way you use this is you create a script that takes in as its first<br>
argument a count. The script passes into LLVM the count via a command<br>
line flag that disables a pass after LLVM has run after the pass has<br>
run for count number of times. Then the script invokes a test of some<br>
sort and indicates whether LLVM successfully compiled the test via the<br>
scripts exit status. Then you invoke bisect as follows:<br>
<br>
bisect --start=<start_num> --end=<end_num> ./script.sh "%(count)s"<br>
<br>
And bisect will continually call ./script.sh with various counts using<br>
the exit status to determine success and failure.<br>
<br>
Added:<br>
    llvm/trunk/utils/bisect   (with props)<br>
<br>
Added: llvm/trunk/utils/bisect<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/bisect?rev=214610&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/bisect?rev=214610&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/utils/bisect (added)<br>
+++ llvm/trunk/utils/bisect Fri Aug  1 20:39:08 2014<br>
@@ -0,0 +1,37 @@<br>
+#!/usr/bin/env python<br>
+<br>
+import os<br>
+import sys<br>
+import argparse<br>
+import subprocess<br>
+<br>
+parser = argparse.ArgumentParser()<br>
+<br>
+parser.add_argument('--start', type=int, default=0)<br>
+parser.add_argument('--end', type=int, default=(1 << 32))<br>
+parser.add_argument('command', nargs='+')<br>
+<br>
+args = parser.parse_args()<br>
+<br>
+start = args.start<br>
+end = args.end<br>
+<br>
+print("Bisect Starting!")<br>
+print("Start: %d" % start)<br>
+print("End: %d" % end)<br>
+<br>
+last = None<br>
+while start != end and start != end-1:<br>
+    count = start + (end - start)/2<br>
+    print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end))<br>
+    cmd = [x % {'count':count} for x in args.command]<br>
+    print cmd<br>
+    result = subprocess.call(cmd)<br>
+    if result == 0:<br>
+        print("    PASSES! Setting start to count")<br>
+        start = count<br>
+    else:<br>
+        print("    FAILS! Setting end to count")<br>
+        end = count<br>
+<br>
+print("Last good count: %d" % start)<br>
<br>
Propchange: llvm/trunk/utils/bisect<br>
------------------------------------------------------------------------------<br>
    svn:executable = *<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
</blockquote></div><br></div></body></html>