[PATCH] D140693: [Driver][RISCV] Adjust the priority between -mcpu, -mtune and -march

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 16:16:51 PST 2023


MaskRay accepted this revision.
MaskRay added inline comments.


================
Comment at: clang/test/Driver/riscv-march-mcpu-mtune.c:30
+// MARCH-RV32IMAFDC: "-target-feature" "+c"
+// MARCH-RV32IMAFDC-NOT: "-target-cpu"
+
----------------
This NOT pattern isn't useful as `-target-cpu` has occurred.


================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:333
+void RISCVISAInfo::toFeatures(std::vector<StringRef> &Features,
+                              std::function<StringRef(const Twine &)> StrAlloc,
+                              bool AddAllExtensions) const {
----------------
Use `function_ref` (in llvm::)


================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:348
+  if (AddAllExtensions) {
+    for (auto const Ext : SupportedExtensions) {
+      if (Exts.find(Ext.Name) != Exts.end())
----------------
`auto const` => `RISCVSupportedExtension` (optional `const`)


================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:349
+    for (auto const Ext : SupportedExtensions) {
+      if (Exts.find(Ext.Name) != Exts.end())
+        continue;
----------------
```
for ...
  if (!Exts.count...)
    Features.push_back...
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140693/new/

https://reviews.llvm.org/D140693



More information about the cfe-commits mailing list