[PATCH] D101833: [AArch64][SVE] Fix missed immediate selection due to mishandling of signedness

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 03:55:27 PDT 2021


david-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp:3128
+                  ((int32_t)ImmVal >= -32768) &&
+                  ((int32_t)ImmVal <= 32512)) {
+        Shift = CurDAG->getTargetConstant(8, DL, MVT::i32);
----------------
bsmith wrote:
> efriedma wrote:
> > Does checking `((int32_t)ImmVal >= -32768) && ((int32_t)ImmVal <= 32512))` actually do anything?  All 16-bit immediates should be in that range.
> It possibly doesn't, however the thing that makes me nervous here is that the incoming `CNode` value is an i32 so could in theory (if something has gone wrong?) have a value outside of that range. It might be best to do it like this if nothing else to prevent an issue further up the pipeline propagating into a codegen fault here?
I guess you could possibly remove those checks and replace them with an assert?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101833



More information about the llvm-commits mailing list