[PATCH] D146277: Handle the unexpected inputs for pass HardwareLoops

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 04:06:06 PDT 2023


samparker added inline comments.


================
Comment at: llvm/lib/CodeGen/HardwareLoops.cpp:330
 
+  assert(
+      Opts.Bitwidth.has_value() && Opts.Decrement.has_value() &&
----------------
XinWang10 wrote:
> fhahn wrote:
> > It shouldn't be possible to trigger an assert when passing arguments to the pass. If there's an invalid combination, it should be handled gracefully, e.g. bailing out without doing anything (together with a debug message perhaps) or using a sane default value if it makes sense.
> I'm not familiar with this pass so I'm not sure how to correctly handle the unexpected input, maybe someone can refine it later? But for now, the wrong input is unacceptable b/c it will lead to crash.
So, `hardware-loop-counter-bitwidth` defaults to 32. so how about we set the default value of `HardwareLoopInfo.CountType` to `Int32Ty`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146277



More information about the llvm-commits mailing list