[VectorCombine] Freeze index unless it is known to be non-poison.
authorFlorian Hahn <flo@fhahn.com>
Tue, 1 Jun 2021 09:20:42 +0000 (10:20 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 1 Jun 2021 09:40:57 +0000 (10:40 +0100)
commitd4c070d801413186c5a59cede9d721e9ca099708
tree6b80fee9665da16d7caf414bf711d843c2fc2d64
parent4f500c402b7357808d9595313438f223447dcace
[VectorCombine] Freeze index unless it is known to be non-poison.

If the index itself is already poison, the poison propagates through
instructions clamping the index to a valid range. This still causes
introducing a load of poison, as flagged by Alive2 and pointed out
at 575e2aff5574.

This patch updates the code to freeze the index, unless it is proven to
not be poison.

Reviewed By: nlopes

Differential Revision: https://reviews.llvm.org/D103378
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/AArch64/load-extractelement-scalarization.ll