[llvm] [ValueTracking] Use isSafeToSpeculativelyExecuteWithVariableReplaced() in more places (PR #109149)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 10:19:41 PDT 2024


================
@@ -476,7 +476,8 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
   // it may make the operand poison.
   BinaryOperator *BO;
   if (match(SrcVec, m_BinOp(BO)) && cheapToScalarize(SrcVec, Index) &&
-      (HasKnownValidIndex || isSafeToSpeculativelyExecute(BO))) {
+      (HasKnownValidIndex ||
+       isSafeToSpeculativelyExecuteWithVariableReplaced(BO))) {
----------------
nikic wrote:

See the comment above this code: We may replace the operand with poison if the extractelement index is out of bounds.

https://github.com/llvm/llvm-project/pull/109149


More information about the llvm-commits mailing list