diff options
author | Björn Pettersson <bjorn.a.pettersson@ericsson.com> | 2025-09-17 23:04:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-17 21:04:00 +0000 |
commit | 1c4c7bd808e7de02a1d1ec7432333f14de132a95 (patch) | |
tree | b991e540b905f42baebb0e4b0ea1f16b77be7111 /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
parent | 96f2ab28fcf010fffc83b7c87707f27bf637fb92 (diff) | |
download | llvm-1c4c7bd808e7de02a1d1ec7432333f14de132a95.zip llvm-1c4c7bd808e7de02a1d1ec7432333f14de132a95.tar.gz llvm-1c4c7bd808e7de02a1d1ec7432333f14de132a95.tar.bz2 |
[SelectionDAG] Deal with POISON for INSERT_VECTOR_ELT/INSERT_SUBVECTOR (#143102)
As reported in https://github.com/llvm/llvm-project/issues/141034
SelectionDAG::getNode had some unexpected
behaviors when trying to create vectors with UNDEF elements. Since
we treat both UNDEF and POISON as undefined (when using isUndef())
we can't just fold away INSERT_VECTOR_ELT/INSERT_SUBVECTOR based on
isUndef(), as that could make the resulting vector more poisonous.
Same kind of bug existed in DAGCombiner::visitINSERT_SUBVECTOR.
Here are some examples:
This fold was done even if vec[idx] was POISON:
INSERT_VECTOR_ELT vec, UNDEF, idx -> vec
This fold was done even if any of vec[idx..idx+size] was POISON:
INSERT_SUBVECTOR vec, UNDEF, idx -> vec
This fold was done even if the elements not extracted from vec could
be POISON:
sub = EXTRACT_SUBVECTOR vec, idx
INSERT_SUBVECTOR UNDEF, sub, idx -> vec
With this patch we avoid such folds unless we can prove that the
result isn't more poisonous when eliminating the insert.
Fixes https://github.com/llvm/llvm-project/issues/141034
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions