[PATCH] D133309: [GlobalISel] Combine G_INSERT/EXTRACT_VECTOR_ELT with out of bounds indices to undef.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 03:29:15 PDT 2022
aemerson added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2345-2346
+ return false;
+ return Idx->getSExtValue() >= VecTy.getNumElements() ||
+ Idx->getSExtValue() < 0;
+}
----------------
foad wrote:
> 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.
Great, D132978 is a good clean up for the IR.
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