[llvm] [InstCombine] Pull vector reverse through intrinsics (PR #146384)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 11:02:42 PDT 2025


================
@@ -1456,6 +1456,45 @@ InstCombinerImpl::foldShuffledIntrinsicOperands(IntrinsicInst *II) {
   return new ShuffleVectorInst(NewIntrinsic, Mask);
 }
 
+/// If all arguments of the intrinsic are reverses, try to pull the reverse
+/// after the intrinsic.
+Value *InstCombinerImpl::foldReversedIntrinsicOperands(IntrinsicInst *II) {
+  if (!isTriviallyVectorizable(II->getIntrinsicID()) ||
+      !II->getCalledFunction()->isSpeculatable())
----------------
preames wrote:

Do we need to speculate it?  The reverse isn't changing which lanes are active.  

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


More information about the llvm-commits mailing list