[llvm] InstCombine: Fold shufflevector(select) and shufflevector(phi) (PR #113746)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 03:54:15 PDT 2024


================
@@ -2900,6 +2900,17 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
   if (Instruction *I = foldIdentityPaddedShuffles(SVI))
     return I;
 
+  if (Constant *C = dyn_cast<Constant>(RHS)) {
+    if (SelectInst *SI = dyn_cast<SelectInst>(LHS)) {
+      if (Instruction *I = FoldOpIntoSelect(SVI, SI))
+        return I;
+    }
+    if (PHINode *PN = dyn_cast<PHINode>(LHS)) {
----------------
RKSimon wrote:

(style) use auto *PN

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


More information about the llvm-commits mailing list