[clang] [clang][utils] Add auto mode to reduction script (PR #163282)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 09:04:07 PDT 2025


================
@@ -424,11 +490,76 @@ def run_creduce(self):
             print("\n\nctrl-c detected, killed reduction tool")
             p.kill()
 
+    def run_llvm_reduce(self):
+        full_llvm_reduce_cmd = [
+            llvm_reduce_cmd,
+            f"--test={self.testfile}",
+            self.ir_file,
+        ]
+        print("\nRunning llvm-reduce tool...")
+        verbose_print(quote_cmd(full_llvm_reduce_cmd))
+        try:
+            p = subprocess.Popen(full_llvm_reduce_cmd)
+            p.communicate()
+        except KeyboardInterrupt:
+            # Hack to kill C-Reduce because it jumps into its own pgid
+            print("\n\nctrl-c detected, killed reduction tool")
----------------
ilovepi wrote:

I removed the comment since I don't think it applies.

The `Ctrl-C` behavior w/ this block seems pretty consistent w/ the original tool. Dropping the call to kill still seems to kill the subprocess, but IDK if there is any reason not to just keep it, since it seems safe/conservative. I think it makes sense to just keep the print so the tool is consistent. WDYT?

https://github.com/llvm/llvm-project/pull/163282


More information about the cfe-commits mailing list