[llvm] [llvm][lit] Omit vendor in triples for "native" feature (PR #136325)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 09:50:39 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Raul Tambre (tambry)
<details>
<summary>Changes</summary>
The vendor component may be different, e.g. x86_64-linux-gnu vs x86_64-pc-linux-gnu, but it's still native.
---
Full diff: https://github.com/llvm/llvm-project/pull/136325.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/llvm/config.py (+12-2)
``````````diff
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index c134cda90e2ee..0b40a407f8f69 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -24,6 +24,16 @@ def user_is_root():
return False
+def remove_triple_vendor(triple):
+ components = triple.split("-")
+
+ # Remove vendor component (e.g. unknown, pc) if present.
+ if len(components) == 4:
+ del components[1]
+
+ return "-".join(components)
+
+
class LLVMConfig(object):
def __init__(self, lit_config, config):
self.lit_config = lit_config
@@ -108,14 +118,14 @@ def __init__(self, lit_config, config):
elif platform.system() == "OS/390":
features.add("system-zos")
- # Native compilation: host arch == default triple arch
+ # Native compilation: host arch == default triple arch (sans vendor)
# Both of these values should probably be in every site config (e.g. as
# part of the standard header. But currently they aren't)
host_triple = getattr(config, "host_triple", None)
target_triple = getattr(config, "target_triple", None)
features.add("host=%s" % host_triple)
features.add("target=%s" % target_triple)
- if host_triple and host_triple == target_triple:
+ if host_triple and remove_triple_vendor(host_triple) == remove_triple_vendor(target_triple):
features.add("native")
# Sanitizers.
``````````
</details>
https://github.com/llvm/llvm-project/pull/136325
More information about the llvm-commits
mailing list