[clang] [ARM] make -mtp=TPIDRURO the default if the target architecture support a hardware thread pointer (PR #128901)

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 01:29:03 PST 2025


================
@@ -239,7 +239,7 @@ arm::ReadTPMode arm::getReadTPMode(const Driver &D, const ArgList &Args,
       D.Diag(diag::err_drv_invalid_mtp) << A->getAsString(Args);
     return ReadTPMode::Invalid;
   }
-  return ReadTPMode::Soft;
+  return (isHardTPSupported(Triple) ? ReadTPMode::TPIDRURO : ReadTPMode::Soft);
----------------
smithp35 wrote:

We're missing out on handling an explicit `-mtp=auto` here. While rare I think it is worth matching gcc.

I think this could be done with changing
```
if (Arg *A = Args.getLastArg(options::OPT_mtp_mode_EQ))
```
To
```
Arg *A = Args.getLastArg(options::OPT_mtp_mode_EQ);
if (A && A->getValue() != "auto") {
  ...
}
return (isHardTPSupported(Triple) ? ReadTPMode::TPIDRURO : ReadTPMode::Soft);
```

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


More information about the cfe-commits mailing list