-
Notifications
You must be signed in to change notification settings - Fork 15.1k
X86: Make sure compiler-rt div calls are not added for msvc #164591
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
X86: Make sure compiler-rt div calls are not added for msvc #164591
Conversation
|
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-aarch64 Author: Matt Arsenault (arsenm) ChangesThe current predicate system is primitive, we ought to have Full diff: https://github.com/llvm/llvm-project/pull/164591.diff 1 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 243b864ccf033..c9e08e844f2a0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -2450,6 +2450,11 @@ def _aullrem : RuntimeLibcallImpl<UREM_I64>;
def _allmul : RuntimeLibcallImpl<MUL_I64>;
}
+// FIXME: Should have utility function to filter by known provider.
+defvar WindowsDivRemMulLibcallOverrides = [
+ __divdi3, __udivdi3, __moddi3, __umoddi3, __muldi3
+];
+
//===----------------------------------------------------------------------===//
// X86 Runtime Libcalls
//===----------------------------------------------------------------------===//
@@ -2471,7 +2476,7 @@ defvar X86_F128_Libcalls = LibcallImpls<(add LibmF128Libcalls, LibmF128FiniteLib
defvar SinCosF32F64Libcalls = LibcallImpls<(add sincosf, sincos), hasSinCos_f32_f64>;
defvar X86CommonLibcalls =
- (add WinDefaultLibcallImpls,
+ (add (sub WinDefaultLibcallImpls, WindowsDivRemMulLibcallOverrides),
DarwinSinCosStret, DarwinExp10,
X86_F128_Libcalls,
LibmHasSinCosF80, // FIXME: Depends on long double
@@ -2494,10 +2499,15 @@ defvar Windows32DivRemMulCalls =
LibcallsWithCC<(add WindowsDivRemMulLibcalls), X86_STDCALL,
RuntimeLibcallPredicate<"TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment()">>;
+defvar NotWindows32DivRemMulCalls =
+ LibcallImpls<(add WindowsDivRemMulLibcallOverrides),
+ RuntimeLibcallPredicate<"!TT.isWindowsMSVCEnvironment() && !TT.isWindowsItaniumEnvironment()">>;
+
def X86_32SystemLibrary
: SystemRuntimeLibrary<isX86_32,
(add X86CommonLibcalls,
- Windows32DivRemMulCalls)>;
+ NotWindows32DivRemMulCalls,
+ Windows32DivRemMulCalls)>;
def X86_64SystemLibrary
: SystemRuntimeLibrary<isX86_64,
|
|
@llvm/pr-subscribers-backend-arm Author: Matt Arsenault (arsenm) ChangesThe current predicate system is primitive, we ought to have Full diff: https://github.com/llvm/llvm-project/pull/164591.diff 1 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 243b864ccf033..c9e08e844f2a0 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -2450,6 +2450,11 @@ def _aullrem : RuntimeLibcallImpl<UREM_I64>;
def _allmul : RuntimeLibcallImpl<MUL_I64>;
}
+// FIXME: Should have utility function to filter by known provider.
+defvar WindowsDivRemMulLibcallOverrides = [
+ __divdi3, __udivdi3, __moddi3, __umoddi3, __muldi3
+];
+
//===----------------------------------------------------------------------===//
// X86 Runtime Libcalls
//===----------------------------------------------------------------------===//
@@ -2471,7 +2476,7 @@ defvar X86_F128_Libcalls = LibcallImpls<(add LibmF128Libcalls, LibmF128FiniteLib
defvar SinCosF32F64Libcalls = LibcallImpls<(add sincosf, sincos), hasSinCos_f32_f64>;
defvar X86CommonLibcalls =
- (add WinDefaultLibcallImpls,
+ (add (sub WinDefaultLibcallImpls, WindowsDivRemMulLibcallOverrides),
DarwinSinCosStret, DarwinExp10,
X86_F128_Libcalls,
LibmHasSinCosF80, // FIXME: Depends on long double
@@ -2494,10 +2499,15 @@ defvar Windows32DivRemMulCalls =
LibcallsWithCC<(add WindowsDivRemMulLibcalls), X86_STDCALL,
RuntimeLibcallPredicate<"TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment()">>;
+defvar NotWindows32DivRemMulCalls =
+ LibcallImpls<(add WindowsDivRemMulLibcallOverrides),
+ RuntimeLibcallPredicate<"!TT.isWindowsMSVCEnvironment() && !TT.isWindowsItaniumEnvironment()">>;
+
def X86_32SystemLibrary
: SystemRuntimeLibrary<isX86_32,
(add X86CommonLibcalls,
- Windows32DivRemMulCalls)>;
+ NotWindows32DivRemMulCalls,
+ Windows32DivRemMulCalls)>;
def X86_64SystemLibrary
: SystemRuntimeLibrary<isX86_64,
|
The current predicate system is primitive, we ought to have a way to list a chain of alternatives.
71b7a3e to
66d3765
Compare
c9b25df to
a84fbd5
Compare
rnk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just ship the clang_rt.builtins everywhere at this point. It's in the issue tracker somewhere, but I haven't been able to make it a priority.

The current predicate system is primitive, we ought to have
a way to list a chain of alternatives.