================
@@ -986,11 +986,23 @@ InstructionCost TargetTransformInfo::getShuffleCost(
 
 TargetTransformInfo::PartialReductionExtendKind
 TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
-  if (isa<SExtInst>(I))
-    return PR_SignExtend;
-  if (isa<ZExtInst>(I))
+  auto *Cast = dyn_cast<CastInst>(I);
+  if (!Cast)
+    return PR_None;
+  return getPartialReductionExtendKind(Cast->getOpcode());
+}
+
+TargetTransformInfo::PartialReductionExtendKind
+TargetTransformInfo::getPartialReductionExtendKind(
+    Instruction::CastOps ExtOpcode) {
+  switch (ExtOpcode) {
+  case Instruction::CastOps::ZExt:
     return PR_ZeroExtend;
-  return PR_None;
+  case Instruction::CastOps::SExt:
+    return PR_SignExtend;
+  default:
+    return PR_None;
----------------
sdesmalen-arm wrote:

I think the default case should be an `llvm_unreachable()`, because only 
zero/sign-extend are supported partial reduction extends. The `PR_None` is 
handled by the function above that takes an `Instruction*`.

https://github.com/llvm/llvm-project/pull/136173
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to