[PATCH] D144760: [InstCombine] use demanded vector elements to eliminate partially redundant instructions

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 26 07:22:53 PST 2023


spatel marked 3 inline comments as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1731
+    //
+    // TODO: Handle demand of an arbitrary single element or more than one
+    //       element instead of just element 0.
----------------
goldstein.w.n wrote:
> This also would work for unary operator? I.e you have `Unary(X)` and `Unary(Shuf(X))`?
`fneg` is the only true unary inst; the `fabs` intrinsic can be considered a pseudo unary inst. 

But both of those have shuffle canonicalized after the op, so it doesn't seem like we'd encounter a pattern like this? Let me know if you see a pattern that escapes. 
 
Eg, we also canonicalize fneg after extractelement, but that fold seems to be missing for fabs.


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

https://reviews.llvm.org/D144760



More information about the llvm-commits mailing list