llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> Co-authored-by: Claude Opus 5.5 <noreply@<!-- -->anthropic.com> --- Full diff: https://github.com/llvm/llvm-project/pull/240731.diff 2 Files Affected: - (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+16-5) - (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll (+3-2) ``````````diff diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td index 7922f88ec6e7a..740958cb8b255 100644 --- a/llvm/include/llvm/IR/RuntimeLibcalls.td +++ b/llvm/include/llvm/IR/RuntimeLibcalls.td @@ -249,6 +249,8 @@ foreach IntTy = [TypeSuffix<"I8", UInt8>, TypeSuffix<"I16", UInt16>, def UREM_#IntTy.Suffix : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type]>; } +defvar OutPtrAttrs = [NoAlias, WriteOnly, NonNull]; + foreach IntTy = [TypeSuffix<"I32", Int32>, TypeSuffix<"I64", Int64>, TypeSuffix<"I128", Int128>] in { def MULO_#IntTy.Suffix @@ -259,14 +261,24 @@ foreach IntTy = [TypeSuffix<"I8", Int8>, TypeSuffix<"I16", Int16>, TypeSuffix<"I32", Int32>, TypeSuffix<"I64", Int64>, TypeSuffix<"I128", Int128>] in { def SDIVREM_#IntTy.Suffix - : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]>; + : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]> { + let FnAttrs = MathFnAttrs; + let Memory = ArgMemWriteOnly; + let ParamAttrs = [[], [], OutPtrAttrs]; + let ParamPointeeTypes = [NoneType, NoneType, IntTy.Type]; + } } foreach IntTy = [TypeSuffix<"I8", UInt8>, TypeSuffix<"I16", UInt16>, TypeSuffix<"I32", UInt32>, TypeSuffix<"I64", UInt64>, TypeSuffix<"I128", UInt128>] in { def UDIVREM_#IntTy.Suffix - : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]>; + : RuntimeLibcall<IntTy.Type, [IntTy.Type, IntTy.Type, Ptr]> { + let FnAttrs = MathFnAttrs; + let Memory = ArgMemWriteOnly; + let ParamAttrs = [[], [], OutPtrAttrs]; + let ParamPointeeTypes = [NoneType, NoneType, IntTy.Type]; + } } foreach IntTy = [Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64] in { @@ -281,8 +293,9 @@ class DivRemPairImpl<RuntimeLibcall P, string Name = NAME> defvar IntTy = P.ReturnType; let ReturnType = !cast<FuncArgType>(!cast<string>(IntTy) # "Pair"); let ArgumentTypes = [IntTy, IntTy]; - let FnAttrs = MathFnAttrs; let Memory = NoMemory; + let ParamAttrs = []; + let ParamPointeeTypes = []; } foreach IntTy = [TypeSuffix<"I32", Int32>, TypeSuffix<"I64", Int64>] in { @@ -302,8 +315,6 @@ def F80 : TypeSuffix<"F80", X86FP80>; def F128 : TypeSuffix<"F128", FP128>; def PPCF128 : TypeSuffix<"PPCF128", PPCFP128>; -defvar OutPtrAttrs = [NoAlias, WriteOnly, NonNull]; - foreach FPTy = [F32, F64] in { def SQRT_#FPTy.Suffix : RuntimeLibcall<FPTy.Type, [FPTy.Type]> { let FnAttrs = MathFnAttrs; diff --git a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll index 38cd3b1fb77ab..08012cf5dd1c9 100644 --- a/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll +++ b/llvm/test/Transforms/Util/DeclareRuntimeLibcalls/divmod.ll @@ -17,9 +17,10 @@ ; WINDOWS: declare arm_aapcscc inreg { i64, i64 } @__rt_udiv64(i64, i64) #0 ; WINDOWS: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) } -; DARWIN: declare i32 @__divmodsi4(i32, i32, ptr) -; DARWIN: declare i32 @__udivmodsi4(i32, i32, ptr) +; DARWIN: declare i32 @__divmodsi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[DIVMOD_ATTRS:#[0-9]+]] +; DARWIN: declare i32 @__udivmodsi4(i32, i32, ptr noalias nonnull writeonly align 4 dereferenceable(4)) [[DIVMOD_ATTRS]] ; DARWIN-NOT: inreg { i32, i32 } @__divmodsi4 +; DARWIN: attributes [[DIVMOD_ATTRS]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) } define void @f() { ret void `````````` </details> https://github.com/llvm/llvm-project/pull/240731 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
