@@ -794,17 +794,21 @@ bool VectorCombine::foldBitcastShuffle(Instruction &I) {
794794 IsUnary ? TargetTransformInfo::SK_PermuteSingleSrc
795795 : TargetTransformInfo::SK_PermuteTwoSrc;
796796
797- InstructionCost DestCost =
797+ InstructionCost NewCost =
798798 TTI.getShuffleCost (SK, NewShuffleTy, NewMask, CostKind) +
799799 (NumOps * TTI.getCastInstrCost (Instruction::BitCast, NewShuffleTy, SrcTy,
800800 TargetTransformInfo::CastContextHint::None,
801801 CostKind));
802- InstructionCost SrcCost =
802+ InstructionCost OldCost =
803803 TTI.getShuffleCost (SK, SrcTy, Mask, CostKind) +
804804 TTI.getCastInstrCost (Instruction::BitCast, DestTy, OldShuffleTy,
805805 TargetTransformInfo::CastContextHint::None,
806806 CostKind);
807- if (DestCost > SrcCost || !DestCost.isValid ())
807+
808+ LLVM_DEBUG (dbgs () << " Found a bitcasted shuffle: " << I << " \n OldCost: "
809+ << OldCost << " vs NewCost: " << NewCost << " \n " );
810+
811+ if (NewCost > OldCost || !NewCost.isValid ())
808812 return false ;
809813
810814 // bitcast (shuf V0, V1, MaskC) --> shuf (bitcast V0), (bitcast V1), MaskC'
0 commit comments