[PATCH] D39465: Add feature to determine if host architecture is 64-bit in llvm-lit

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 11:41:32 PDT 2017


zturner added inline comments.


================
Comment at: test/lit.cfg.py:171
 # Features
+config.available_features.add(config.host_arch + "-host-arch")
+
----------------
So if I remember correctly from discussing on IRC, `HOST_ARCH` is the equivalent of running `uname -p`, but now we're adding `host-arch-is-64bit` which is not a simple function of `HOST_ARCH`, since `uname -p` might return `unknown`.

If so, I think this is going to lead to confusion.  To be honest, if `HOST_ARCH` is unreliable as you say, then we shouldn't be using it for anything and I would just assume deprecate it in favor of having everything be based on `llvm_host_triple`.

With that in mind, I think it would be better to just delete this feature.


================
Comment at: test/lit.cfg.py:173-175
+for host_arch64 in ["x86_64", "mips64", "ppc64", "aarch64"]:
+  if config.llvm_host_triple.startswith(host_arch64):
+    config.available_features.add("host-arch-is-64bit")
----------------
This is again slightly confusing, because what does "host arch" mean?  Does it mean the physical processor installed in the machine?  The bitness of the OS that is running?  Or the bitness of the LLVM toolchain that is running?  In this case it's the latter (the bitness of the LLVM toolchain that is running), so can we call this "llvm-64-bits" or something to make it more clear what this feature actually represents?

Also, as a minor nit, I think it would be slightly more pythonic to write this as:

```
known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
if any(config.llvm_host_triple.startswith(x) for x in known_arches):
  config.available_features.add("llvm-64-bits")
```


Repository:
  rL LLVM

https://reviews.llvm.org/D39465





More information about the llvm-commits mailing list