[clang] [llvm] [RISCV][Clang][TargetParser] Support getting feature unaligned-scalar-mem from mcpu. (PR #71513)

Francesco Petrogalli via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 7 04:34:22 PST 2023


================
@@ -44,6 +45,11 @@ static const CPUInfo *getCPUInfoByName(StringRef CPU) {
   return nullptr;
 }
 
+bool hasFastUnalignedAccess(StringRef CPU) {
+  const CPUInfo *Info = getCPUInfoByName(CPU);
+  return Info && Info->FastUnalignedAccess;
----------------
fpetrogalli wrote:

Would it make sense to inform the user of invalid CPU names?

```suggestion
  assert(Info && "Invalid CPU name");
  return Info->FastUnalignedAccess;
```

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


More information about the cfe-commits mailing list