[llvm] [AArch64] Give a higher cost for more expensive SVE FCMP instructions (PR #153816)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 29 00:46:41 PDT 2025
================
@@ -4409,6 +4409,33 @@ AArch64TTIImpl::getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE,
return 1;
}
+/// Check whether Opcode1 has less throughput according to the scheduling
+/// model than Opcode2.
+bool AArch64TTIImpl::hasKnownLowerThroughputFromSchedulingModel(
+ unsigned Opcode1, unsigned Opcode2) const {
+ const MCSchedModel &Sched = ST->getSchedModel();
+ const TargetInstrInfo *TII = ST->getInstrInfo();
+ if (!Sched.hasInstrSchedModel())
+ return false;
+
+ const MCSchedClassDesc *SCD1 =
+ Sched.getSchedClassDesc(TII->get(Opcode1).getSchedClass());
+ const MCSchedClassDesc *SCD2 =
+ Sched.getSchedClassDesc(TII->get(Opcode2).getSchedClass());
+ // We cannot handle variant scheduling classes without an MI. If we need to
+ // support them for any of the instructions we query the information of we
+ // might need to add a qay to resolve them without a MI or not use the
+ // scheduling info.
+ assert(!SCD1->isVariant() && !SCD2->isVariant() &&
----------------
david-arm wrote:
There is an assert here that SCD1 and SCD2 are not variants, but the code below suggests it's fine to have variants since we'll just return false. I think it's worth being stronger here by just going one way or the other, i.e. either:
1. Assert but don't check and add a comment to the function saying this shouldn't be called for opcodes with variants, or
2. Remove the assert and bail out if they are variants.
What do you think?
https://github.com/llvm/llvm-project/pull/153816
More information about the llvm-commits
mailing list