Skip to content

Commit 9b6d7d6

Browse files
committed
Skip predicate types, improve arg count checks
1 parent c08072d commit 9b6d7d6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,9 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
574574
// relatively low cost.
575575

576576
// If arguments aren't actually supplied, then we cannot determine the
577-
// value of the index.
578-
if (ICA.getArgs().size() < 2)
577+
// value of the index. We also want to skip this on predicate types.
578+
if (ICA.getArgs().size() != 2 ||
579+
ICA.getReturnType()->getScalarType()->isIntegerTy(1))
579580
break;
580581
LLVMContext &C = RetTy->getContext();
581582
EVT MRTy = getTLI()->getValueType(DL, RetTy);
@@ -586,7 +587,7 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
586587
if (RLK.first == TargetLoweringBase::TypeLegal &&
587588
PLK.first == TargetLoweringBase::TypeLegal && Idx &&
588589
Idx->getZExtValue() == 0)
589-
return InstructionCost(1);
590+
return TTI::TCC_Basic;
590591
break;
591592
}
592593
case Intrinsic::vector_insert: {
@@ -595,8 +596,9 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
595596
// relatively low cost.
596597

597598
// If arguments aren't actually supplied, then we cannot determine the
598-
// value of the index.
599-
if (ICA.getArgs().size() < 3)
599+
// value of the index. We also want to skip this on predicate types.
600+
if (ICA.getArgs().size() != 3 ||
601+
ICA.getReturnType()->getScalarType()->isIntegerTy(1))
600602
break;
601603
LLVMContext &C = RetTy->getContext();
602604
EVT MTy0 = getTLI()->getValueType(DL, ICA.getArgTypes()[0]);
@@ -607,7 +609,7 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
607609
if (LK0.first == TargetLoweringBase::TypeLegal &&
608610
LK1.first == TargetLoweringBase::TypeLegal && Idx &&
609611
Idx->getZExtValue() == 0)
610-
return InstructionCost(1);
612+
return TTI::TCC_Basic;
611613
break;
612614
}
613615
case Intrinsic::bitreverse: {

0 commit comments

Comments
 (0)