-
Notifications
You must be signed in to change notification settings - Fork 15.2k
ARM: Avoid doing strncmp on libcall name #165203
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
arsenm
merged 2 commits into
main
from
users/arsenm/arm/avoid-doing-string-comparison-libcall-name
Oct 31, 2025
Merged
ARM: Avoid doing strncmp on libcall name #165203
arsenm
merged 2 commits into
main
from
users/arsenm/arm/avoid-doing-string-comparison-libcall-name
Oct 31, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-backend-arm Author: Matt Arsenault (arsenm) ChangesCheck if the default implementation is the aeabi impl directly. Full diff: https://github.com/llvm/llvm-project/pull/165203.diff 1 Files Affected:
diff --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
index ebfa593fbe9e6..d921c8b47c6cb 100644
--- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
@@ -35,6 +35,19 @@ bool ARMSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {
Opcode <= ARMISD::LAST_MEMORY_OPCODE;
}
+static bool isAEABIFunctionImpl(const TargetLowering &TLI, RTLIB::Libcall LC) {
+ switch (LC) {
+ case RTLIB::MEMCPY:
+ return TLI.getLibcallImpl(LC) == RTLIB::impl___aeabi_memcpy;
+ case RTLIB::MEMMOVE:
+ return TLI.getLibcallImpl(LC) == RTLIB::impl___aeabi_memmove;
+ case RTLIB::MEMSET:
+ return TLI.getLibcallImpl(LC) == RTLIB::impl___aeabi_memset;
+ default:
+ return false;
+ }
+}
+
// Emit, if possible, a specialized version of the given Libcall. Typically this
// means selecting the appropriately aligned version, but we also convert memset
// of 0 into memclr.
@@ -47,7 +60,7 @@ SDValue ARMSelectionDAGInfo::EmitSpecializedLibcall(
// Only use a specialized AEABI function if the default version of this
// Libcall is an AEABI function.
- if (std::strncmp(TLI->getLibcallName(LC), "__aeabi", 7) != 0)
+ if (!isAEABIFunctionImpl(*TLI, LC))
return SDValue();
// Translate RTLIB::Libcall to AEABILibcall. We only do this in order to be
|
MacDue
reviewed
Oct 27, 2025
Check if the default implementation is the aeabi impl directly. If getLibcallName returned null, this would crash.
6843aba to
446dd8e
Compare
MacDue
approved these changes
Oct 31, 2025
DEBADRIBASAK
pushed a commit
to DEBADRIBASAK/llvm-project
that referenced
this pull request
Nov 3, 2025
Check if the default implementation is the aeabi impl directly. If getLibcallName returned null, this would crash.
ckoparkar
pushed a commit
to ckoparkar/llvm-project
that referenced
this pull request
Nov 6, 2025
Check if the default implementation is the aeabi impl directly. If getLibcallName returned null, this would crash.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Check if the default implementation is the aeabi impl directly.
If getLibcallName returned null, this would crash.