[llvm] [InlineCost] Consider the default branch when calculating cost (PR #77856)
Quentin Dian via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 20:02:37 PST 2024
================
@@ -446,6 +446,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
/// inline cost heuristic, but it's a generic cost model to be used in other
/// places (e.g., in loop unrolling).
unsigned N = SI.getNumCases();
+ bool HasDefault =
+ !isa<UnreachableInst>(SI.getDefaultDest()->getFirstNonPHIOrDbg());
----------------
DianQK wrote:
> Can you move this default-is-unreachable into a helper on SwitchInst instead of repeating it twice?
Thanks. I was thinking of doing that, but I wanted to submit a separate PR.
https://github.com/llvm/llvm-project/pull/77856
More information about the llvm-commits
mailing list