Skip to content

RuntimeLibcalls: Remove __muloti4 from default libcall set #148562

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

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jul 14, 2025

The current logic says it's only available on wasm, so only
explicitly add it there. Also fix a misnomer in the compiler-rt
call list.

@arsenm arsenm marked this pull request as ready for review July 14, 2025 04:19
@llvmbot
Copy link
Member

llvmbot commented Jul 14, 2025

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

The current logic says it's only available on wasm, so only
explicitly add it there. Also fix a misnomer in the compiler-rt
call list.


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

1 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+9-4)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 9781bef8e37b6..53eea97bf1ea9 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -459,7 +459,6 @@ def __multi3 : RuntimeLibcallImpl<MUL_I128>;
 
 def __mulosi4 : RuntimeLibcallImpl<MULO_I32>;
 def __mulodi4 : RuntimeLibcallImpl<MULO_I64>;
-def __muloti4 : RuntimeLibcallImpl<MULO_I128>;
 
 def __divqi3 : RuntimeLibcallImpl<SDIV_I8>;
 def __divhi3 : RuntimeLibcallImpl<SDIV_I16>;
@@ -935,6 +934,12 @@ def calloc : RuntimeLibcallImpl<CALLOC>;
 
 } // End let IsDefault = true
 
+//--------------------------------------------------------------------
+// compiler-rt, not available for most architectures
+//--------------------------------------------------------------------
+
+def __muloti4 : RuntimeLibcallImpl<MULO_I128>;
+
 //--------------------------------------------------------------------
 // Define implementation other libcalls
 //--------------------------------------------------------------------
@@ -1036,7 +1041,7 @@ defvar Int128RTLibcalls = [
 ];
 
 // Only available in compiler-rt
-defvar CompilerRTOnlyInt128Libcalls = [
+defvar CompilerRTOnlyInt64Libcalls = [
   __mulodi4
 ];
 
@@ -1057,7 +1062,7 @@ defvar DefaultRuntimeLibcallImpls =
   !listremove(
     !listremove(
         !listremove(AllDefaultRuntimeLibcallImpls, Int128RTLibcalls),
-                    CompilerRTOnlyInt128Libcalls),
+                    CompilerRTOnlyInt64Libcalls),
                     DefaultRuntimeLibcallImpls_f80),
                     DefaultRuntimeLibcallImpls_ppcf128);
 
@@ -2130,5 +2135,5 @@ def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
 def WasmSystemLibrary
     : SystemRuntimeLibrary<isWasm,
       (add DefaultRuntimeLibcallImpls, Int128RTLibcalls,
-           CompilerRTOnlyInt128Libcalls,
+           CompilerRTOnlyInt64Libcalls, __muloti4,
            emscripten_return_address)>;

@@ -1036,7 +1041,7 @@ defvar Int128RTLibcalls = [
];

// Only available in compiler-rt
defvar CompilerRTOnlyInt128Libcalls = [
defvar CompilerRTOnlyInt64Libcalls = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the rename? This libcall works on 128 bit integers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for MULO_I64

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, duh. Shouldn't it get dropped from the Int128RTLibcalls list directly above?

@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/remove-muloti4-default-calls branch from 18ca551 to 19c269f Compare July 14, 2025 10:15
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor Author

arsenm commented Jul 14, 2025

Merge activity

  • Jul 14, 3:51 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 14, 3:53 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 14, 3:56 PM UTC: @arsenm merged this pull request with Graphite.

arsenm added 2 commits July 14, 2025 15:53
The current logic says it's only available on wasm, so only
explicitly add it there. Also fix a misnomer in the compiler-rt
call list.
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/remove-muloti4-default-calls branch from 19c269f to 953c476 Compare July 14, 2025 15:53
@arsenm arsenm merged commit 91d017a into main Jul 14, 2025
7 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/runtime-libcalls/remove-muloti4-default-calls branch July 14, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants