[PATCH] D133309: [GlobalISel] Combine G_INSERT/EXTRACT_VECTOR_ELT with out of bounds indices to undef.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 01:36:31 PDT 2022


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2345-2346
+    return false;
+  return Idx->getSExtValue() >= VecTy.getNumElements() ||
+         Idx->getSExtValue() < 0;
+}
----------------
See discussion on D132978. I think we should be treating these indices as unsigned, so I would suggest just `return Idx->getZExtValue() >= VecTy.getNumElements()`. The behaviour should be the same as what you have written except in weird cases where the type of Idx is very narrow.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133309



More information about the llvm-commits mailing list