From dd359d636075c9baec9f0f59e4262f52e14d7567 Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Fri, 24 May 2024 13:53:01 +0000
Subject: [PATCH] configure: do not set LLC/OPT/LLVMAS fallback values when
 FIND_LLVM_PROG fails

When configure fails to find LLC/OPT/LLVMAS within supported version
range, it used to set "llc"/"opt"/"clang" as fallback values. This
behavior is particularly troublesome when the user has llc/opt/clang
with other versions in their PATH and run the testsuite, since hadrian
will incorrectly assume have_llvm=True and pass that to the testsuite
driver, resulting in annoying optllvm test failures (#23186). If
configure determines llc/opt/clang wouldn't work, then we shouldn't
pretend it'll work at all, and the bindist configure will invoke
FIND_LLVM_PROG check again at install time anyway.

(cherry picked from commit 4eb5ad09cf93caa5791a735baa0e7ba86b916f2a)
---
 m4/fp_settings.m4 | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/m4/fp_settings.m4 b/m4/fp_settings.m4
index 05c30c18bb2..829d03a2e56 100644
--- a/m4/fp_settings.m4
+++ b/m4/fp_settings.m4
@@ -123,19 +123,10 @@ AC_DEFUN([FP_SETTINGS],
     fi
 
     # LLVM backend tools
-    if test -z "$LlcCmd"; then
-        LlcCmd="llc"
-    fi
     SettingsLlcCommand="$LlcCmd"
 
-    if test -z "$OptCmd"; then
-        OptCmd="opt"
-    fi
     SettingsOptCommand="$OptCmd"
 
-    if test -z "$LlvmAsCmd"; then
-        LlvmAsCmd="clang"
-    fi
     SettingsLlvmAsCommand="$LlvmAsCmd"
 
     # Mac-only tools
-- 
GitLab