Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISCV] Use hasStdExtCOrZca instead of hasStdExtC in estimateFunctionSizeInBytes. #80905

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Feb 6, 2024

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

…SizeInBytes.

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

llvmbot commented Feb 6, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/80905.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVFrameLowering.cpp (+1-1)
diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index d793c0b7377ba..745ae68123b08 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;

Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

With the assembler changes from a while back, this should not be simply a heuristic.

@topperc topperc merged commit c8a97c0 into llvm:main Feb 6, 2024
5 of 6 checks passed
@topperc topperc deleted the pr/zca-funcsize branch February 6, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants