[PATCH] D108669: [WebAssembly] Fix up out-of-range BUILD_VECTOR lane constants

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 17:19:34 PDT 2021


dschuff accepted this revision.
dschuff added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2055
+        if (Const &&
+            (Val < -(1 << (LaneBits - 1)) || Val > (1 << (LaneBits - 1)) - 1)) {
+          auto NewVal = ((uint64_t)Val % (1u << LaneBits)) - (1u << LaneBits);
----------------
dschuff wrote:
> as we discussed offline, maybe we could turn the first half of this expression into an assert.
> It might be nice if we could give names to any other of these subexpressions, but I don't know what any of them would be...
Extra condition looks good. It might still be a good idea to do the assert though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108669



More information about the llvm-commits mailing list