Skip to content

RuntimeLibcalls: Cleanup darwin bzero configuration #145639

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

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 25, 2025

Write this in a more predicate-apply style instead of the
switch.

Copy link
Contributor Author

arsenm commented Jun 25, 2025

@arsenm arsenm requested review from fhahn and JDevlieghere June 25, 2025 05:52
@arsenm arsenm marked this pull request as ready for review June 25, 2025 05:52
@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2025

@llvm/pr-subscribers-backend-aarch64

Author: Matt Arsenault (arsenm)

Changes

Write this in a more predicate-apply style instead of the
switch.


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

1 Files Affected:

  • (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+2-10)
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index cb8c8457f5a47..5c01d8595d0f9 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -432,19 +432,11 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
     setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2");
 
     // Some darwins have an optimized __bzero/bzero function.
-    switch (TT.getArch()) {
-    case Triple::x86:
-    case Triple::x86_64:
+    if (TT.isX86()) {
       if (TT.isMacOSX() && !TT.isMacOSXVersionLT(10, 6))
         setLibcallName(RTLIB::BZERO, "__bzero");
-      break;
-    case Triple::aarch64:
-    case Triple::aarch64_32:
+    } else if (TT.isAArch64())
       setLibcallName(RTLIB::BZERO, "bzero");
-      break;
-    default:
-      break;
-    }
 
     if (darwinHasSinCosStret(TT)) {
       setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");

@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2025

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

Write this in a more predicate-apply style instead of the
switch.


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

1 Files Affected:

  • (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+2-10)
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index cb8c8457f5a47..5c01d8595d0f9 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -432,19 +432,11 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
     setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2");
 
     // Some darwins have an optimized __bzero/bzero function.
-    switch (TT.getArch()) {
-    case Triple::x86:
-    case Triple::x86_64:
+    if (TT.isX86()) {
       if (TT.isMacOSX() && !TT.isMacOSXVersionLT(10, 6))
         setLibcallName(RTLIB::BZERO, "__bzero");
-      break;
-    case Triple::aarch64:
-    case Triple::aarch64_32:
+    } else if (TT.isAArch64())
       setLibcallName(RTLIB::BZERO, "bzero");
-      break;
-    default:
-      break;
-    }
 
     if (darwinHasSinCosStret(TT)) {
       setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");

Copy link
Contributor

@fhahn fhahn 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

@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/cleanup-darwin-has-bzero branch from 2fdd403 to 9eebced Compare June 25, 2025 09:45
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/cleanup-darwin-exp10-handling branch from 5266f79 to 56a5cab Compare June 25, 2025 09:45
Copy link
Contributor Author

arsenm commented Jun 25, 2025

Merge activity

  • Jun 25, 11:01 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 25, 11:10 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 25, 11:13 AM UTC: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/cleanup-darwin-exp10-handling branch from 56a5cab to c975ea8 Compare June 25, 2025 11:07
Base automatically changed from users/arsenm/runtime-libcalls/cleanup-darwin-exp10-handling to main June 25, 2025 11:09
Write this in a more predicate-apply style instead of the
switch.
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/cleanup-darwin-has-bzero branch from 9eebced to ae0b97b Compare June 25, 2025 11:10
@arsenm arsenm merged commit 62d3685 into main Jun 25, 2025
5 of 7 checks passed
@arsenm arsenm deleted the users/arsenm/runtime-libcalls/cleanup-darwin-has-bzero branch June 25, 2025 11:13
anthonyhatran pushed a commit to anthonyhatran/llvm-project that referenced this pull request Jun 26, 2025
Write this in a more predicate-apply style instead of the
switch.
rlavaee pushed a commit to rlavaee/llvm-project that referenced this pull request Jul 1, 2025
Write this in a more predicate-apply style instead of the
switch.
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.

3 participants