[PATCH] D108694: [RISCV] Add the zvl extension according to the v1.0 spec

Yueh-Ting Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 13 19:12:39 PST 2021


eopXD added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:134
          "maximum!");
+  assert(RVVVectorBitsMin >= ZvlLen &&
+         "Minimum V extension vector length should be at least the length "
----------------
eopXD wrote:
> eopXD wrote:
> > craig.topper wrote:
> > > eopXD wrote:
> > > > craig.topper wrote:
> > > > > HsiangKai wrote:
> > > > > > Should it be `RVVVectorBitsMin < ZvlLen`?
> > > > > > 
> > > > > > I suggest to return 0 and print a warning message for users.
> > > > > This isn't a good place to print warnings. It would just be a random message printed to stderr without going through any of clang's diagnostic infrastructure.
> > > > I think moving the check to `initializeSubtargetDependencies` and use `report_fatal_error` will be a more appropriate approach?
> > > I think that causes clang to generate a crash report and telling the user to file a bug.
> > > 
> > > Forgot to mention, all this code is also being modified by D107290
> > I see, then my proposal is invalid.
> > 
> > I am not yet that familiar with the code base. I see `RISCVFrameLowering.cpp` using `LLVMContext::diagnose`, but `RISCVSubtarget` here doesn't seem to have access to `LLVMContext`. 
> > 
> > May you recommend a pointer to some diagnose function I can use to tell the user this is an invalid setting between `RVVVectorBitsMin`(from `riscv-v-vector-bits-min`) and `ZvlLen` (from `-march=zvl*b`)?
> I see code under `RISCVSubtarget::initializeSubtargetDependencies` also using `report_fatal_error`:
> 
I am marking this thread as done since there are no further comments.

This patch currently uses `report_fatal_error` for it. Although as Craig mentioned it may not be ideal.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108694



More information about the cfe-commits mailing list