[llvm] [LLVM][Docs] Remove bugpoint references (PR #214251)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 17:47:53 PDT 2026
https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/214251
>From 9a79c029bbd202034ae4e7299cda6e329a0f8730 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Wed, 5 Aug 2026 15:13:35 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
=?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
[skip ci]
---
llvm/utils/bugpoint_gisel_reducer.py | 152 ---------------
llvm/utils/findmisopt | 177 ------------------
.../gn/secondary/llvm/tools/bugpoint/BUILD.gn | 44 -----
3 files changed, 373 deletions(-)
delete mode 100755 llvm/utils/bugpoint_gisel_reducer.py
delete mode 100755 llvm/utils/findmisopt
delete mode 100644 llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
diff --git a/llvm/utils/bugpoint_gisel_reducer.py b/llvm/utils/bugpoint_gisel_reducer.py
deleted file mode 100755
index 116ec792e921d..0000000000000
--- a/llvm/utils/bugpoint_gisel_reducer.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/usr/bin/env python
-
-"""Reduces GlobalISel failures.
-
-This script is a utility to reduce tests that GlobalISel
-fails to compile.
-
-It runs llc to get the error message using a regex and creates
-a custom command to check that specific error. Then, it runs bugpoint
-with the custom command.
-
-"""
-from __future__ import print_function
-import argparse
-import re
-import subprocess
-import sys
-import tempfile
-import os
-
-
-def log(msg):
- print(msg)
-
-
-def hr():
- log("-" * 50)
-
-
-def log_err(msg):
- print("ERROR: {}".format(msg), file=sys.stderr)
-
-
-def check_path(path):
- if not os.path.exists(path):
- log_err("{} does not exist.".format(path))
- raise
- return path
-
-
-def check_bin(build_dir, bin_name):
- file_name = "{}/bin/{}".format(build_dir, bin_name)
- return check_path(file_name)
-
-
-def run_llc(llc, irfile):
- pr = subprocess.Popen(
- [llc, "-o", "-", "-global-isel", "-pass-remarks-missed=gisel", irfile],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- )
- out, err = pr.communicate()
- res = pr.wait()
- if res == 0:
- return 0
- re_err = re.compile(
- r"LLVM ERROR: ([a-z\s]+):.*(G_INTRINSIC[_A-Z]* <intrinsic:@[a-zA-Z0-9\.]+>|G_[A-Z_]+)"
- )
- match = re_err.match(err)
- if not match:
- return 0
- else:
- return [match.group(1), match.group(2)]
-
-
-def run_bugpoint(bugpoint_bin, llc_bin, opt_bin, tmp, ir_file):
- compileCmd = "-compile-command={} -c {} {}".format(
- os.path.realpath(__file__), llc_bin, tmp
- )
- pr = subprocess.Popen(
- [
- bugpoint_bin,
- "-compile-custom",
- compileCmd,
- "-opt-command={}".format(opt_bin),
- ir_file,
- ]
- )
- res = pr.wait()
- if res != 0:
- log_err("Unable to reduce the test.")
- raise
-
-
-def run_bugpoint_check():
- path_to_llc = sys.argv[2]
- path_to_err = sys.argv[3]
- path_to_ir = sys.argv[4]
- with open(path_to_err, "r") as f:
- err = f.read()
- res = run_llc(path_to_llc, path_to_ir)
- if res == 0:
- return 0
- log("GlobalISed failed, {}: {}".format(res[0], res[1]))
- if res != err.split(";"):
- return 0
- else:
- return 1
-
-
-def main():
- # Check if this is called by bugpoint.
- if len(sys.argv) == 5 and sys.argv[1] == "-c":
- sys.exit(run_bugpoint_check())
-
- # Parse arguments.
- parser = argparse.ArgumentParser(
- description=__doc__, formatter_class=argparse.RawTextHelpFormatter
- )
- parser.add_argument("BuildDir", help="Path to LLVM build directory")
- parser.add_argument("IRFile", help="Path to the input IR file")
- args = parser.parse_args()
-
- # Check if the binaries exist.
- build_dir = check_path(args.BuildDir)
- ir_file = check_path(args.IRFile)
- llc_bin = check_bin(build_dir, "llc")
- opt_bin = check_bin(build_dir, "opt")
- bugpoint_bin = check_bin(build_dir, "bugpoint")
-
- # Run llc to see if GlobalISel fails.
- log("Running llc...")
- res = run_llc(llc_bin, ir_file)
- if res == 0:
- log_err("Expected failure")
- raise
- hr()
- log("GlobalISel failed, {}: {}.".format(res[0], res[1]))
- tmp = tempfile.NamedTemporaryFile()
- log("Writing error to {} for bugpoint.".format(tmp.name))
- tmp.write(";".join(res))
- tmp.flush()
- hr()
-
- # Run bugpoint.
- log("Running bugpoint...")
- run_bugpoint(bugpoint_bin, llc_bin, opt_bin, tmp.name, ir_file)
- hr()
- log("Done!")
- hr()
- output_file = "bugpoint-reduced-simplified.bc"
- log("Run llvm-dis to disassemble the output:")
- log("$ {}/bin/llvm-dis -o - {}".format(build_dir, output_file))
- log("Run llc to reproduce the problem:")
- log(
- "$ {}/bin/llc -o - -global-isel "
- "-pass-remarks-missed=gisel {}".format(build_dir, output_file)
- )
-
-
-if __name__ == "__main__":
- main()
diff --git a/llvm/utils/findmisopt b/llvm/utils/findmisopt
deleted file mode 100755
index 24052209428cf..0000000000000
--- a/llvm/utils/findmisopt
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/bin/bash
-#
-# findmisopt
-#
-# This is a quick and dirty hack to potentially find a misoptimization
-# problem. Mostly its to work around problems in bugpoint that prevent
-# it from finding a problem unless the set of failing optimizations are
-# known and given to it on the command line.
-#
-# Given a bitcode file that produces correct output (or return code),
-# this script will run through all the optimizations passes that gccas
-# uses (in the same order) and will narrow down which optimizations
-# cause the program either generate different output or return a
-# different result code. When the passes have been narrowed down,
-# bugpoint is invoked to further refine the problem to its origin. If a
-# release version of bugpoint is available it will be used, otherwise
-# debug.
-#
-# Usage:
-# findmisopt bcfile outdir progargs [match]
-#
-# Where:
-# bcfile
-# is the bitcode file input (the unoptimized working case)
-# outdir
-# is a directory into which intermediate results are placed
-# progargs
-# is a single argument containing all the arguments the program needs
-# proginput
-# is a file name from which stdin should be directed
-# match
-# if specified to any value causes the result code of the program to
-# be used to determine success/fail. If not specified success/fail is
-# determined by diffing the program's output with the non-optimized
-# output.
-#
-if [ "$#" -lt 3 ] ; then
- echo "usage: findmisopt bcfile outdir progargs [match]"
- exit 1
-fi
-
-dir="${0%%/utils/findmisopt}"
-if [ -x "$dir/Release/bin/bugpoint" ] ; then
- bugpoint="$dir/Release/bin/bugpoint"
-elif [ -x "$dir/Debug/bin/bugpoint" ] ; then
- bugpoint="$dir/Debug/bin/bugpoint"
-else
- echo "findmisopt: bugpoint not found"
- exit 1
-fi
-
-bcfile="$1"
-outdir="$2"
-args="$3"
-input="$4"
-if [ ! -f "$input" ] ; then
- input="/dev/null"
-fi
-match="$5"
-name=`basename $bcfile .bc`
-ll="$outdir/${name}.ll"
-s="$outdir/${name}.s"
-prog="$outdir/${name}"
-out="$outdir/${name}.out"
-optbc="$outdir/${name}.opt.bc"
-optll="$outdir/${name}.opt.ll"
-opts="$outdir/${name}.opt.s"
-optprog="$outdir/${name}.opt"
-optout="$outdir/${name}.opt.out"
-ldflags="-lstdc++ -lm -ldl -lc"
-
-echo "Test Name: $name"
-echo "Unoptimized program: $prog"
-echo " Optimized program: $optprog"
-
-# Define the list of optimizations to run. This comprises the same set of
-# optimizations that opt -O3 runs, in the same order.
-opt_switches=`llvm-as < /dev/null -o - | opt -O3 -disable-output -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
-all_switches="$opt_switches"
-echo "Passes : $all_switches"
-
-# Create output directory if it doesn't exist
-if [ -f "$outdir" ] ; then
- echo "$outdir is not a directory"
- exit 1
-fi
-
-if [ ! -d "$outdir" ] ; then
- mkdir "$outdir" || exit 1
-fi
-
-# Generate the disassembly
-llvm-dis "$bcfile" -o "$ll" -f || exit 1
-
-# Generate the non-optimized program and its output
-llc "$bcfile" -o "$s" -f || exit 1
-gcc "$s" -o "$prog" $ldflags || exit 1
-"$prog" $args > "$out" 2>&1 <$input
-ex1=$?
-
-# Current set of switches is empty
-function tryit {
- switches_to_use="$1"
- opt $switches_to_use "$bcfile" -o "$optbc" -f || exit
- llvm-dis "$optbc" -o "$optll" -f || exit
- llc "$optbc" -o "$opts" -f || exit
- gcc "$opts" -o "$optprog" $ldflags || exit
- "$optprog" $args > "$optout" 2>&1 <"$input"
- ex2=$?
-
- if [ -n "$match" ] ; then
- if [ "$ex1" -ne "$ex2" ] ; then
- echo "Return code not the same with these switches:"
- echo $switches
- echo "Unoptimized returned: $ex1"
- echo "Optimized returned: $ex2"
- return 0
- fi
- else
- diff "$out" "$optout" > /dev/null
- if [ $? -ne 0 ] ; then
- echo "Diff fails with these switches:"
- echo $switches
- echo "Differences:"
- diff "$out" "$optout" | head
- return 0;
- fi
- fi
- return 1
-}
-
-echo "Trying to find optimization that breaks program:"
-for sw in $all_switches ; do
- echo -n " $sw"
- switches="$switches $sw"
- if tryit "$switches" ; then
- break;
- fi
-done
-
-# Terminate the previous output with a newline
-echo ""
-
-# Determine if we're done because none of the optimizations broke the program
-if [ "$switches" == " $all_switches" ] ; then
- echo "The program did not miscompile"
- exit 0
-fi
-
-final=""
-while [ ! -z "$switches" ] ; do
- trimmed=`echo "$switches" | sed -e 's/^ *\(-[^ ]*\).*/\1/'`
- switches=`echo "$switches" | sed -e 's/^ *-[^ ]* *//'`
- echo "Trimmed $trimmed from left"
- tryit "$final $switches"
- if [ "$?" -eq "0" ] ; then
- echo "Still Failing .. continuing ..."
- continue
- else
- echo "Found required early pass: $trimmed"
- final="$final $trimmed"
- continue
- fi
- echo "Next Loop"
-done
-
-if [ "$final" == " $all_switches" ] ; then
- echo "findmisopt: All optimizations pass. Perhaps this isn't a misopt?"
- exit 0
-fi
-echo "Smallest Optimization list=$final"
-
-bpcmd="$bugpoint -run-llc -disable-loop-extraction --output "$out" --input /dev/null $bcfile $final --args $args"
-
-echo "Running: $bpcmd"
-$bpcmd
-echo "findmisopt finished."
diff --git a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
deleted file mode 100644
index b1225aaa53f9b..0000000000000
--- a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
+++ /dev/null
@@ -1,44 +0,0 @@
-executable("bugpoint") {
- deps = [
- "//llvm/include/llvm/Config:config",
- "//llvm/include/llvm/Config:llvm-config",
- "//llvm/lib/Analysis",
- "//llvm/lib/Bitcode/Writer",
- "//llvm/lib/CodeGen",
- "//llvm/lib/Extensions",
- "//llvm/lib/IR",
- "//llvm/lib/IRReader",
- "//llvm/lib/Linker",
- "//llvm/lib/Plugins",
- "//llvm/lib/Support",
- "//llvm/lib/Target",
- "//llvm/lib/Target:TargetsToBuild",
- "//llvm/lib/TargetParser",
- "//llvm/lib/Transforms/AggressiveInstCombine",
- "//llvm/lib/Transforms/IPO",
- "//llvm/lib/Transforms/Instrumentation",
- "//llvm/lib/Transforms/ObjCARC",
- "//llvm/lib/Transforms/Scalar",
- "//llvm/lib/Transforms/Utils",
- "//llvm/lib/Transforms/Vectorize",
- ]
- sources = [
- "BugDriver.cpp",
- "CrashDebugger.cpp",
- "ExecutionDriver.cpp",
- "ExtractFunction.cpp",
- "FindBugs.cpp",
- "Miscompilation.cpp",
- "OptimizerDriver.cpp",
- "ToolRunner.cpp",
- "bugpoint.cpp",
- ]
-
- # Support plugins.
- # FIXME: Disable dead stripping once other binaries are dead-stripped.
- if (host_os != "mac" && host_os != "win") {
- # Make sure bugpoint plugins can access bugpoint's symbols.
- # Corresponds to export_executable_symbols() in cmake.
- ldflags = [ "-rdynamic" ]
- }
-}
More information about the llvm-commits
mailing list