[llvm] [RISCV] Use hasStdExtCOrZca instead of hasStdExtC in estimateFunctionSizeInBytes. (PR #80905)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 13:04:02 PST 2024


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/80905

I'm not sure how to test this. I commented out the existing hasStdC check and no tests failed.

>From 636ad7504d0e8a7b38fd1aa873aa8fed2ecec6af Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 6 Feb 2024 13:02:14 -0800
Subject: [PATCH] [RISCV] Use hasStdExtCOrZca instead of hasStdExtC in
 estimateFunctionSizeInBytes.

I'm not sure how to test this. I commented out the existing hasStdC
check and no tests failed.
---
 llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index d793c0b7377baf..745ae68123b086 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -1172,7 +1172,7 @@ static unsigned estimateFunctionSizeInBytes(const MachineFunction &MF,
       if (MI.isConditionalBranch())
         FnSize += TII.getInstSizeInBytes(MI);
       if (MI.isConditionalBranch() || MI.isUnconditionalBranch()) {
-        if (MF.getSubtarget<RISCVSubtarget>().hasStdExtC())
+        if (MF.getSubtarget<RISCVSubtarget>().hasStdExtCOrZca())
           FnSize += 2 + 8 + 2 + 2;
         else
           FnSize += 4 + 8 + 4 + 4;



More information about the llvm-commits mailing list