[PATCH] D135625: [instcombine] (extelt (inselt Vec, Value, Index), Index) -> Value

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 03:32:20 PDT 2022


nikic added a comment.

In D135625#3858141 <https://reviews.llvm.org/D135625#3858141>, @paulwalker-arm wrote:

> Sorry for the post commit question but I recall similar work being blocked when we wanted to say `extractelt(splat(x), idx) -> x` but the consensus was it could be an invalid transformation because if `idx` is out of range then the result is poison.  Does this transformation fall into the same trap whereby we're incorrectly removing a source of poison?  I'm not specifically seeking a revert I just want to understand the rules because for scalable vectors there are several instances where we are being hampered by such poison preservation.

It's fine to remove a source of poison, you just can't add one.

While the transform implemented here is correct, it is part of the wrong pass. This should be part of InstSimplify in simplifyExtractElementInst(). Can you please move it there?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135625/new/

https://reviews.llvm.org/D135625



More information about the llvm-commits mailing list