Skip to content

Commit e3157d3

Browse files
committed
[VectorCombine] foldBitcastShuffle - add debug message for match + cost-comparison
Helps with debugging to show to that the fold found the match, and shows the old + new costs to indicate whether the fold was/wasn't profitable.
1 parent 1418018 commit e3157d3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)