[PATCH] D137934: [InstCombine] Fold extractelt with select of constants

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 22:49:47 PST 2022


foad accepted this revision.
foad added a comment.
This revision is now accepted and ready to land.

The code LGTM.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:401-402
 
+  // extractelt (select %x, <vec1>, <vec2>), %const ->
+  // select %x, <vec1>[%const], <vec2>[%const]
+  // FIXME: Support multiple select operands during constant folding:
----------------
Why do you write `<vec1>` instead of `%vec1`? I found it confusing to have two different syntaxes for variables in the same line.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:403-406
+  // FIXME: Support multiple select operands during constant folding:
+  // extractelt (select %c, %<vec1>, %<vec2>), (select %c, %c1, %c2)
+  // This is currently not possible because constant folding will reach
+  // an unreachable assertion if it doesn't find a constant operand.
----------------
I don't really understand this comment. "FIXME" suggests that something is broken. What is broken? What would you like to fold `extractelt (select %c, %<vec1>, %<vec2>), (select %c, %c1, %c2)` into?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137934



More information about the llvm-commits mailing list