[PATCH] D45240: [ARM] Compute a target feature which corresponds to the ARM version.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 5 12:52:24 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Basic/Targets/ARM.cpp:345
   // get default FPU features
+  llvm::ARM::ArchKind Arch = llvm::ARM::parseArch(getTriple().getArchName());
   unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU, Arch);
----------------
fhahn wrote:
> Is there a reason we re-compute the Arch from the triple here, but use the member variable ArchKind above? Shouldn't they both be the same ?
ArchKind is based on the triple and the CPU, where "Arch" is just based on the triple, so "Arch" was returning the wrong thing in some cases.

Actually, looking a bit more, we should probably be calling parseCPUArch here to get the right behavior, rather than depending on the member.  (It doesn't usually matter, but it could make a difference for code using "target" attribute, I guess.  That feature needs a lot more work, though.)


Repository:
  rC Clang

https://reviews.llvm.org/D45240





More information about the cfe-commits mailing list