[llvm] [VectorCombine] Relax vector type constraint on bitop(bitcast, bitcast) (PR #157245)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 02:28:18 PDT 2025


================
@@ -870,38 +870,37 @@ bool VectorCombine::foldBitOpOfCastops(Instruction &I) {
   if (LHSSrc->getType() != RHSSrc->getType())
     return false;
 
-  // Only handle vector types with integer elements
-  auto *SrcVecTy = dyn_cast<FixedVectorType>(LHSSrc->getType());
-  auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());
-  if (!SrcVecTy || !DstVecTy)
+  auto *SrcTy = LHSSrc->getType();
+  auto *DstTy = I.getType();
+  // Only handle vector types with integer elements if the cast is not bitcast
----------------
RKSimon wrote:

Split this comment - bitcasts can handle scalar/vector mixes - explain the integer requirement below at the isIntegerTy tests

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


More information about the llvm-commits mailing list