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

[llvm][AArch64] Add missing default cases #89930

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

Troy-Butler
Copy link
Contributor

@Troy-Butler Troy-Butler commented Apr 24, 2024

Addresses issue #89709.

Functions getAUTOpcodeForKey() and getPACOpcodeForKey() contain switch statements without default cases. Resolved by adding a call to llvm_unreachable() at the end of each function.

Signed-off-by: Troy-Butler <squintik@outlook.com>
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 24, 2024

@llvm/pr-subscribers-backend-aarch64

Author: Troy Butler (Troy-Butler)

Changes

Addresses issue #89709.

Functions getAUTOpcodeForKey() and getPACOpcodeForKey() contain switch statements without default cases. Resolved by adding a default case.


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

1 Files Affected:

  • (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.h (+2)
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
index 9a2914891675c5..fe4943ab43cc8f 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
@@ -724,6 +724,7 @@ static inline unsigned getAUTOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
   case IB: return Zero ? AArch64::AUTIZB : AArch64::AUTIB;
   case DA: return Zero ? AArch64::AUTDZA : AArch64::AUTDA;
   case DB: return Zero ? AArch64::AUTDZB : AArch64::AUTDB;
+  default: return 0;
   }
 }
 
@@ -736,6 +737,7 @@ static inline unsigned getPACOpcodeForKey(AArch64PACKey::ID K, bool Zero) {
   case IB: return Zero ? AArch64::PACIZB : AArch64::PACIB;
   case DA: return Zero ? AArch64::PACDZA : AArch64::PACDA;
   case DB: return Zero ? AArch64::PACDZB : AArch64::PACDB;
+  default: return 0;
   }
 }
 

@davemgreen
Copy link
Collaborator

Can you make it an llvm_unreachable, as in getXPACOpcodeForKey? I believe there are only 4 valid values.

Copy link

github-actions bot commented Apr 24, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Signed-off-by: Troy-Butler <squintik@outlook.com>
Signed-off-by: Troy-Butler <squintik@outlook.com>
@Troy-Butler
Copy link
Contributor Author

Can you make it an llvm_unreachable, as in getXPACOpcodeForKey? I believe there are only 4 valid values.

Certainly!

Copy link
Collaborator

@momchil-velikov momchil-velikov left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@Troy-Butler
Copy link
Contributor Author

LGTM. Thanks!

I don't have merge rights, so if everything looks good, can the last reviewer please merge this into main? Thank you!

@DanielKristofKiss DanielKristofKiss merged commit 3c2e614 into llvm:main Apr 24, 2024
3 of 4 checks passed
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

5 participants