[llvm] [VectorCombine] Add Cmp and Select for shuffleToIdentity (PR #92794)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 03:40:11 PDT 2024


================
@@ -1742,6 +1742,10 @@ static Value *generateNewInstTree(ArrayRef<InstLane> Item, FixedVectorType *Ty,
   if (auto *BI = dyn_cast<BinaryOperator>(I))
     return Builder.CreateBinOp((Instruction::BinaryOps)BI->getOpcode(), Ops[0],
                                Ops[1]);
+  if (auto CI = dyn_cast<CmpInst>(I))
+    return Builder.CreateCmp(CI->getPredicate(), Ops[0], Ops[1]);
+  if (auto SI = dyn_cast<SelectInst>(I))
----------------
artagnon wrote:

In the future, to catch such nits, I would recommend getting the official clangd extension from LLVM in VSCode (if you use VSCode to contribute to LLVM): it will automatically yellow-underline such instances, and prompt you about the fix.

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


More information about the llvm-commits mailing list