[PATCH] D137934: [InstCombine] Fold extractelt with select of constants
Thomas Symalla via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 00:03:13 PST 2022
tsymalla added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/extractelement.ll:816
+}
+
define i32 @extelt_select_const_operand_extractelt_use(i1 %c) {
----------------
tsymalla wrote:
> arsenm wrote:
> > Needs a test with an out of bounds vector index
> Hmm, I don't know if that makes sense. A trivial case with an `extractelement` with OOB behavior will not be caught by my code, as far as I can see, so it will be folded to a `poison` value.
> I'll double-check and probably remove the OOB check in my code.
Found a possible different issue with the OOB behavior:
```
define i32 @extelt_select_const_operand_vector_oob(i1 %c) {
%oob = select i1 %c, i32 3, i32 4
%s = select i1 %c, <3 x i32> <i32 2, i32 3, i32 4>, <3 x i32> <i32 5, i32 6, i32 7>
%r = extractelement <3 x i32> %s, i32 %oob
ret i32 %r
}
```
will make opt crash during constant folding.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137934/new/
https://reviews.llvm.org/D137934
More information about the llvm-commits
mailing list