[PATCH] D146277: add assert to confirm input is valid for pass HardwareLoops

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 19:26:13 PDT 2023


XinWang10 added inline comments.


================
Comment at: llvm/lib/CodeGen/HardwareLoops.cpp:330
 
+  assert(
+      Opts.Bitwidth.has_value() && Opts.Decrement.has_value() &&
----------------
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.


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