Projects
Mega:24.03
llvm
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 11
View file
_service:tar_scm:llvm.spec
Changed
@@ -1,5 +1,6 @@ %bcond_without sys_llvm %bcond_without check +%bcond_with classic_flang %global maj_ver 17 %global min_ver 0 @@ -37,7 +38,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 7 +Release: 10 Summary: The Low Level Virtual Machine License: NCSA @@ -64,6 +65,10 @@ Patch14: 0014-Backport-X86-Inline-Skip-inline-asm-in-inlining-targ.patch Patch15: 0015-Backport-ARM-Check-all-terms-in-emitPopInst-when-clearing-Res.patch Patch16: 0016-Backport-ARM-Update-IsRestored-for-LR-based-on-all-returns-82.patch +Patch17: 0017-Add-the-support-for-classic-flang.patch +Patch18: 0018-Fix-declaration-definition-mismatch-for-classic-flang.patch +Patch19: 0019-Backport-LoongArch-Improve-the-support-for-atomic-and-clear_cache.patch +Patch20: 0020-Update-llvm-lit-config-to-support-build_for_openeule.patch BuildRequires: binutils-devel BuildRequires: cmake @@ -223,8 +228,10 @@ %else -DLLVM_LIBDIR_SUFFIX= \ %endif +%if %{with classic_flang} + -DLLVM_ENABLE_CLASSIC_FLANG=ON \ +%endif -DLLVM_INCLUDE_BENCHMARKS=OFF - %ninja_build LLVM %ninja_build @@ -346,6 +353,15 @@ %{install_includedir}/llvm-gmock %changelog +* Mon Apr 29 2024 wangqiang <wangqiang1@kylinos.cn> - 17.0.6-10 +- Update llvm-lit config to support macro `build_for_openeuler` + +* Sun Apr 21 2024 zhanglimin <zhanglimin@loongson.cn> - 17.0.6-9 +- Improve the support for atomic and __clear_cache + +* Wed Apr 17 2024 luofeng <luofeng13@huawei.com> - 17.0.6-8 +- Add the support for classic flang + * Fri Apr 12 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-7 - Backport patch to fix CVE-2024-31852 @@ -367,7 +383,7 @@ * Thu Nov 30 2023 zhoujing <zhoujing106@huawei.com> - 17.0.6-1 - Update to 17.0.6 -* Tue Jul 13 2023 cf-zhao <zhaochuanfeng@huawei.com> -12.0.1-7 +* Thu Jul 13 2023 cf-zhao <zhaochuanfeng@huawei.com> -12.0.1-7 - Disable check. * Sat Jul 08 2023 cf-zhao <zhaochuanfeng@huawei.com> -12.0.1-6
View file
_service:tar_scm:0017-Add-the-support-for-classic-flang.patch
Added
@@ -0,0 +1,1776 @@ +From b297f30783da0dfb3098fe6d39b209caacd45691 Mon Sep 17 00:00:00 2001 +From: luofeng14 <luofeng13@huawei.com> +Date: Fri, 1 Mar 2024 18:39:52 +0800 +Subject: PATCH sync classic flang patch + +--- + llvm/cmake/modules/HandleLLVMOptions.cmake | 8 + + llvm/include/llvm-c/DebugInfo.h | 5 +- + .../include/llvm/Analysis/TargetLibraryInfo.h | 6 +- + llvm/include/llvm/Analysis/VecFuncs.def | 592 ++++++++++++++++++ + llvm/include/llvm/IR/DIBuilder.h | 28 +- + llvm/include/llvm/IR/DebugInfoMetadata.h | 32 +- + llvm/lib/Analysis/TargetLibraryInfo.cpp | 38 +- + llvm/lib/AsmParser/LLParser.cpp | 22 +- + llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 42 +- + llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 3 +- + llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h | 54 ++ + .../lib/CodeGen/AsmPrinter/DebugLocStream.cpp | 5 + + llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h | 6 + + .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 3 + + llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 4 + + llvm/lib/IR/AsmWriter.cpp | 1 + + llvm/lib/IR/DIBuilder.cpp | 12 +- + llvm/lib/IR/DebugInfo.cpp | 10 +- + llvm/lib/IR/DebugInfoMetadata.cpp | 12 +- + llvm/lib/IR/LLVMContextImpl.h | 11 +- + .../Instrumentation/InstrProfiling.cpp | 4 +- + .../invalid-diglobalvariable-empty-name.ll | 1 + + .../Generic/fortran-subprogram-at.ll | 24 + + .../DebugInfo/Generic/more-subprogram-attr.ll | 38 ++ + llvm/test/DebugInfo/X86/DICommonBlock.ll | 36 ++ + llvm/test/lit.cfg.py | 3 + + llvm/test/lit.site.cfg.py.in | 1 + + llvm/tools/llvm-c-test/debuginfo.c | 4 +- + llvm/unittests/IR/MetadataTest.cpp | 47 +- + llvm/utils/lit/lit/TestingConfig.py | 1 + + llvm/utils/lit/lit/llvm/config.py | 10 + + 31 files changed, 983 insertions(+), 80 deletions(-) + create mode 100644 llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll + create mode 100644 llvm/test/DebugInfo/Generic/more-subprogram-attr.ll + create mode 100644 llvm/test/DebugInfo/X86/DICommonBlock.ll + +diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake +index 76723be696e5..492ea25b179b 100644 +--- a/llvm/cmake/modules/HandleLLVMOptions.cmake ++++ b/llvm/cmake/modules/HandleLLVMOptions.cmake +@@ -89,6 +89,14 @@ if( LLVM_ENABLE_ASSERTIONS ) + add_compile_definitions(_LIBCPP_ENABLE_HARDENED_MODE) + endif() + ++option(LLVM_ENABLE_CLASSIC_FLANG "Build support for classic Flang instead of the new built-in Flang" OFF) ++if(LLVM_ENABLE_CLASSIC_FLANG) ++ set(LLVM_ENABLE_CLASSIC_FLANG 1) ++ add_definitions( -DENABLE_CLASSIC_FLANG ) ++else() ++ set(LLVM_ENABLE_CLASSIC_FLANG 0) ++endif() ++ + if(LLVM_ENABLE_EXPENSIVE_CHECKS) + add_compile_definitions(EXPENSIVE_CHECKS) + +diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h +index 5924294708cc..09d584c24711 100644 +--- a/llvm/include/llvm-c/DebugInfo.h ++++ b/llvm/include/llvm-c/DebugInfo.h +@@ -1148,7 +1148,8 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( + LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, + size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, + unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, +- LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits); ++ LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags, ++ uint32_t AlignInBits); + + + /** +@@ -1246,7 +1247,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( + LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, + size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, + unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, +- LLVMMetadataRef Decl, uint32_t AlignInBits); ++ LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits); + + /** + * Insert a new llvm.dbg.declare intrinsic call before the given instruction. +diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +index 5d62e837c1f3..490252cd018a 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +@@ -22,7 +22,6 @@ namespace llvm { + template <typename T> class ArrayRef; + class Function; + class Module; +-class Triple; + + /// Describes a possible vectorization of a function. + /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized +@@ -81,6 +80,8 @@ class TargetLibraryInfoImpl { + bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F, + const Module &M) const; + ++ Triple T; ++ + public: + /// List of known vector-functions libraries. + /// +@@ -95,6 +96,9 @@ public: + DarwinLibSystemM, // Use Darwin's libsystem_m. + LIBMVEC_X86, // GLIBC Vector Math library. + MASSV, // IBM MASS vector library. ++#ifdef ENABLE_CLASSIC_FLANG ++ PGMATH, // PGI math library. ++#endif + SVML, // Intel short vector math library. + SLEEFGNUABI, // SLEEF - SIMD Library for Evaluating Elementary Functions. + ArmPL // Arm Performance Libraries. +diff --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def +index b884c1e3911e..d1712d158423 100644 +--- a/llvm/include/llvm/Analysis/VecFuncs.def ++++ b/llvm/include/llvm/Analysis/VecFuncs.def +@@ -909,6 +909,596 @@ TLI_DEFINE_VECFUNC("tgammaf", "armpl_vtgammaq_f32", FIXED(4), NOMASK) + TLI_DEFINE_VECFUNC("tgamma", "armpl_svtgamma_f64_x", SCALABLE(2), MASKED) + TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED) + ++#elif defined(TLI_DEFINE_PGMATH_AARCH64_VECFUNCS) ++// Classic flang libpgmath library's Vector Functions for AArch64 ++ ++TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_2", FIXED(2)) ++TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_4", FIXED(4)) ++ ++TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_2", FIXED(2))
View file
_service:tar_scm:0018-Fix-declaration-definition-mismatch-for-classic-flang.patch
Added
@@ -0,0 +1,1041 @@ +From d6d17d8f0362ac47100be32f0d9cb31fd66a1060 Mon Sep 17 00:00:00 2001 +From: luofeng14 <luofeng13@huawei.com> +Date: Wed, 17 Apr 2024 14:26:07 +0800 +Subject: PATCH Fix declaration definition mismatch for classic flang + +--- + llvm/cmake/modules/TableGen.cmake | 4 + + llvm/include/llvm-c/DebugInfo.h | 11 ++- + .../include/llvm/Analysis/TargetLibraryInfo.h | 5 + + llvm/include/llvm/Analysis/VecFuncs.def | 8 ++ + llvm/include/llvm/IR/DebugInfoMetadata.h | 65 ++++++++++--- + llvm/lib/Analysis/TargetLibraryInfo.cpp | 24 +++++ + llvm/lib/AsmParser/LLParser.cpp | 6 +- + llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 44 ++++++--- + llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 6 ++ + llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h | 4 + + .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 4 +- + llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 8 +- + llvm/lib/IR/AsmWriter.cpp | 2 + + llvm/lib/IR/DIBuilder.cpp | 21 +++- + llvm/lib/IR/DebugInfo.cpp | 22 ++++- + llvm/lib/IR/DebugInfoMetadata.cpp | 19 +++- + llvm/lib/IR/LLVMContextImpl.h | 22 ++++- + .../Instrumentation/InstrProfiling.cpp | 5 +- + llvm/tools/llvm-c-test/debuginfo.c | 12 ++- + llvm/unittests/IR/MetadataTest.cpp | 97 +++++++++++++++---- + llvm/utils/lit/lit/llvm/config.py | 17 ++-- + 21 files changed, 321 insertions(+), 85 deletions(-) + +diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake +index 7fd6628ef55d..d4d2c06c051b 100644 +--- a/llvm/cmake/modules/TableGen.cmake ++++ b/llvm/cmake/modules/TableGen.cmake +@@ -76,6 +76,10 @@ function(tablegen project ofn) + set(tblgen_change_flag "--write-if-changed") + endif() + ++ if (LLVM_ENABLE_CLASSIC_FLANG) ++ list(APPEND tblgen_change_flag "-DENABLE_CLASSIC_FLANG") ++ endif() ++ + if (NOT LLVM_ENABLE_WARNINGS) + list(APPEND LLVM_TABLEGEN_FLAGS "-no-warn-on-unused-template-args") + endif() +diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h +index 09d584c24711..0201bac4349d 100644 +--- a/llvm/include/llvm-c/DebugInfo.h ++++ b/llvm/include/llvm-c/DebugInfo.h +@@ -1148,7 +1148,10 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( + LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, + size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, + unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, +- LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags, ++ LLVMMetadataRef Expr, LLVMMetadataRef Decl, ++#ifdef ENABLE_CLASSIC_FLANG ++ LLVMDIFlags Flags, ++#endif + uint32_t AlignInBits); + + +@@ -1247,7 +1250,11 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( + LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, + size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, + unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, +- LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits); ++ LLVMMetadataRef Decl, ++#ifdef ENABLE_CLASSIC_FLANG ++ LLVMDIFlags Flags, ++#endif ++ uint32_t AlignInBits); + + /** + * Insert a new llvm.dbg.declare intrinsic call before the given instruction. +diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +index 490252cd018a..6805c6535189 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +@@ -22,6 +22,9 @@ namespace llvm { + template <typename T> class ArrayRef; + class Function; + class Module; ++#ifndef ENABLE_CLASSIC_FLANG ++class Triple; ++#endif + + /// Describes a possible vectorization of a function. + /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized +@@ -80,7 +83,9 @@ class TargetLibraryInfoImpl { + bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F, + const Module &M) const; + ++#ifdef ENABLE_CLASSIC_FLANG + Triple T; ++#endif + + public: + /// List of known vector-functions libraries. +diff --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def +index d1712d158423..679e28057d6e 100644 +--- a/llvm/include/llvm/Analysis/VecFuncs.def ++++ b/llvm/include/llvm/Analysis/VecFuncs.def +@@ -910,6 +910,8 @@ TLI_DEFINE_VECFUNC("tgamma", "armpl_svtgamma_f64_x", SCALABLE(2), MASKED) + TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED) + + #elif defined(TLI_DEFINE_PGMATH_AARCH64_VECFUNCS) ++ ++#ifdef ENABLE_CLASSIC_FLANG + // Classic flang libpgmath library's Vector Functions for AArch64 + + TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2)) +@@ -1079,8 +1081,11 @@ TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_4", FIXED(4)) + + TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_2", FIXED(2)) + TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4)) ++#endif + + #elif defined(TLI_DEFINE_PGMATH_X86_VECFUNCS) ++ ++#ifdef ENABLE_CLASSIC_FLANG + // Classic flang libpgmath library's Vector Functions for X86 + + TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2)) +@@ -1498,6 +1503,7 @@ TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_8", FIXED(8)) + TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4)) + TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_8", FIXED(8)) + TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_16", FIXED(16)) ++#endif + + #else + #error "Must choose which vector library functions are to be defined." +@@ -1519,5 +1525,7 @@ TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_16", FIXED(16)) + #undef TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS + #undef TLI_DEFINE_MASSV_VECFUNCS_NAMES + #undef TLI_DEFINE_ARMPL_VECFUNCS ++#ifdef ENABLE_CLASSIC_FLANG + #undef TLI_DEFINE_PGMATH_AARCH64_VECFUNCS + #undef TLI_DEFINE_PGMATH_X86_VECFUNCS ++#endif +diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h +index 9bd86172a4c0..277c2ddd4dd9 100644 +--- a/llvm/include/llvm/IR/DebugInfoMetadata.h ++++ b/llvm/include/llvm/IR/DebugInfoMetadata.h +@@ -3062,14 +3062,23 @@ class DIGlobalVariable : public DIVariable { + + bool IsLocalToUnit; + bool IsDefinition; ++#ifdef ENABLE_CLASSIC_FLANG + DIFlags Flags; ++#endif + + DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line, +- bool IsLocalToUnit, bool IsDefinition, DIFlags Flags, ++ bool IsLocalToUnit, bool IsDefinition, ++#ifdef ENABLE_CLASSIC_FLANG ++ DIFlags Flags, ++#endif + uint32_t AlignInBits, ArrayRef<Metadata *> Ops) + : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits), +- IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), +- Flags(Flags) {} ++#ifdef ENABLE_CLASSIC_FLANG ++ IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), Flags(Flags) {} ++#else ++ IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {} ++#endif ++ + ~DIGlobalVariable() = default; + + static DIGlobalVariable * +@@ -3077,28 +3086,40 @@ class DIGlobalVariable : public DIVariable { + StringRef LinkageName, DIFile *File, unsigned Line, DIType *Type, + bool IsLocalToUnit, bool IsDefinition, + DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams, +- DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations, ++#ifdef ENABLE_CLASSIC_FLANG ++ DIFlags Flags, ++#endif ++ uint32_t AlignInBits, DINodeArray Annotations, + StorageType Storage, bool ShouldCreate = true) { + return getImpl(Context, Scope, getCanonicalMDString(Context, Name), + getCanonicalMDString(Context, LinkageName), File, Line, Type, + IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration, +- cast_or_null<Metadata>(TemplateParams), Flags, AlignInBits, +- Annotations.get(), Storage, ShouldCreate); ++ cast_or_null<Metadata>(TemplateParams), ++#ifdef ENABLE_CLASSIC_FLANG ++ Flags, ++#endif ++ AlignInBits, Annotations.get(), Storage, ShouldCreate); + } + static DIGlobalVariable * + getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, + MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, + bool IsLocalToUnit, bool IsDefinition, + Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams, +- DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations, ++#ifdef ENABLE_CLASSIC_FLANG ++ DIFlags Flags, ++#endif
View file
_service:tar_scm:0019-Backport-LoongArch-Improve-the-support-for-atomic-and-clear_cache.patch
Added
@@ -0,0 +1,12426 @@ +From ad367d826e5959792ce7384be62ba1ccffbf0d9a Mon Sep 17 00:00:00 2001 +From: hev <wangrui@loongson.cn> +Date: Wed, 11 Oct 2023 10:24:18 +0800 +Subject: PATCH 1/7 LoongArch Improve codegen for atomic ops (#67391) + +This PR improves memory barriers generated by atomic operations. + +Memory barrier semantics of LL/SC: +``` +LL: <memory-barrier> + <load-exclusive> +SC: <store-conditional> + <memory-barrier> +``` + +Changes: +* Remove unnecessary memory barriers before LL and between LL/SC. +* Fix acquire semantics. (If the SC instruction is not executed, then +the guarantee of acquiring semantics cannot be ensured. Therefore, an +acquire barrier needs to be generated when memory ordering includes an +acquire operation.) + +(cherry picked from commit 203ba238e33c570dba6cbcf247f1668bb2a13c26) +--- + .../LoongArchExpandAtomicPseudoInsts.cpp | 50 +-- + .../Target/LoongArch/LoongArchInstrInfo.td | 24 +- + .../LoongArch/atomicrmw-uinc-udec-wrap.ll | 24 +- + .../ir-instruction/atomic-cmpxchg.ll | 376 ++++++++++++++++-- + .../LoongArch/ir-instruction/atomicrmw-fp.ll | 24 +- + .../ir-instruction/atomicrmw-minmax.ll | 24 -- + .../LoongArch/ir-instruction/atomicrmw.ll | 31 -- + llvm/unittests/Target/LoongArch/InstSizes.cpp | 2 +- + 8 files changed, 407 insertions(+), 148 deletions(-) + +diff --git a/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp b/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp +index 51df0463e235..eb78ef065b21 100644 +--- a/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp ++++ b/llvm/lib/Target/LoongArch/LoongArchExpandAtomicPseudoInsts.cpp +@@ -153,18 +153,12 @@ static void doAtomicBinOpExpansion(const LoongArchInstrInfo *TII, + Register ScratchReg = MI.getOperand(1).getReg(); + Register AddrReg = MI.getOperand(2).getReg(); + Register IncrReg = MI.getOperand(3).getReg(); +- AtomicOrdering Ordering = +- static_cast<AtomicOrdering>(MI.getOperand(4).getImm()); + + // .loop: +- // if(Ordering != AtomicOrdering::Monotonic) +- // dbar 0 + // ll.w|d dest, (addr) + // binop scratch, dest, val + // sc.w|d scratch, scratch, (addr) + // beqz scratch, loop +- if (Ordering != AtomicOrdering::Monotonic) +- BuildMI(LoopMBB, DL, TII->get(LoongArch::DBAR)).addImm(0); + BuildMI(LoopMBB, DL, + TII->get(Width == 32 ? LoongArch::LL_W : LoongArch::LL_D), DestReg) + .addReg(AddrReg) +@@ -251,12 +245,8 @@ static void doMaskedAtomicBinOpExpansion( + Register AddrReg = MI.getOperand(2).getReg(); + Register IncrReg = MI.getOperand(3).getReg(); + Register MaskReg = MI.getOperand(4).getReg(); +- AtomicOrdering Ordering = +- static_cast<AtomicOrdering>(MI.getOperand(5).getImm()); + + // .loop: +- // if(Ordering != AtomicOrdering::Monotonic) +- // dbar 0 + // ll.w destreg, (alignedaddr) + // binop scratch, destreg, incr + // xor scratch, destreg, scratch +@@ -264,8 +254,6 @@ static void doMaskedAtomicBinOpExpansion( + // xor scratch, destreg, scratch + // sc.w scratch, scratch, (alignedaddr) + // beqz scratch, loop +- if (Ordering != AtomicOrdering::Monotonic) +- BuildMI(LoopMBB, DL, TII->get(LoongArch::DBAR)).addImm(0); + BuildMI(LoopMBB, DL, TII->get(LoongArch::LL_W), DestReg) + .addReg(AddrReg) + .addImm(0); +@@ -372,23 +360,20 @@ bool LoongArchExpandAtomicPseudo::expandAtomicMinMaxOp( + auto LoopHeadMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock()); + auto LoopIfBodyMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock()); + auto LoopTailMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock()); +- auto TailMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock()); + auto DoneMBB = MF->CreateMachineBasicBlock(MBB.getBasicBlock()); + + // Insert new MBBs. + MF->insert(++MBB.getIterator(), LoopHeadMBB); + MF->insert(++LoopHeadMBB->getIterator(), LoopIfBodyMBB); + MF->insert(++LoopIfBodyMBB->getIterator(), LoopTailMBB); +- MF->insert(++LoopTailMBB->getIterator(), TailMBB); +- MF->insert(++TailMBB->getIterator(), DoneMBB); ++ MF->insert(++LoopTailMBB->getIterator(), DoneMBB); + + // Set up successors and transfer remaining instructions to DoneMBB. + LoopHeadMBB->addSuccessor(LoopIfBodyMBB); + LoopHeadMBB->addSuccessor(LoopTailMBB); + LoopIfBodyMBB->addSuccessor(LoopTailMBB); + LoopTailMBB->addSuccessor(LoopHeadMBB); +- LoopTailMBB->addSuccessor(TailMBB); +- TailMBB->addSuccessor(DoneMBB); ++ LoopTailMBB->addSuccessor(DoneMBB); + DoneMBB->splice(DoneMBB->end(), &MBB, MI, MBB.end()); + DoneMBB->transferSuccessors(&MBB); + MBB.addSuccessor(LoopHeadMBB); +@@ -402,11 +387,9 @@ bool LoongArchExpandAtomicPseudo::expandAtomicMinMaxOp( + + // + // .loophead: +- // dbar 0 + // ll.w destreg, (alignedaddr) + // and scratch2, destreg, mask + // move scratch1, destreg +- BuildMI(LoopHeadMBB, DL, TII->get(LoongArch::DBAR)).addImm(0); + BuildMI(LoopHeadMBB, DL, TII->get(LoongArch::LL_W), DestReg) + .addReg(AddrReg) + .addImm(0); +@@ -463,7 +446,6 @@ bool LoongArchExpandAtomicPseudo::expandAtomicMinMaxOp( + // .looptail: + // sc.w scratch1, scratch1, (addr) + // beqz scratch1, loop +- // dbar 0x700 + BuildMI(LoopTailMBB, DL, TII->get(LoongArch::SC_W), Scratch1Reg) + .addReg(Scratch1Reg) + .addReg(AddrReg) +@@ -472,10 +454,6 @@ bool LoongArchExpandAtomicPseudo::expandAtomicMinMaxOp( + .addReg(Scratch1Reg) + .addMBB(LoopHeadMBB); + +- // .tail: +- // dbar 0x700 +- BuildMI(TailMBB, DL, TII->get(LoongArch::DBAR)).addImm(0x700); +- + NextMBBI = MBB.end(); + MI.eraseFromParent(); + +@@ -483,7 +461,6 @@ bool LoongArchExpandAtomicPseudo::expandAtomicMinMaxOp( + computeAndAddLiveIns(LiveRegs, *LoopHeadMBB); + computeAndAddLiveIns(LiveRegs, *LoopIfBodyMBB); + computeAndAddLiveIns(LiveRegs, *LoopTailMBB); +- computeAndAddLiveIns(LiveRegs, *TailMBB); + computeAndAddLiveIns(LiveRegs, *DoneMBB); + + return true; +@@ -535,12 +512,10 @@ bool LoongArchExpandAtomicPseudo::expandAtomicCmpXchg( + .addReg(CmpValReg) + .addMBB(TailMBB); + // .looptail: +- // dbar 0 + // move scratch, newval + // sc.w|d scratch, scratch, (addr) + // beqz scratch, loophead + // b done +- BuildMI(LoopTailMBB, DL, TII->get(LoongArch::DBAR)).addImm(0); + BuildMI(LoopTailMBB, DL, TII->get(LoongArch::OR), ScratchReg) + .addReg(NewValReg) + .addReg(LoongArch::R0); +@@ -573,13 +548,11 @@ bool LoongArchExpandAtomicPseudo::expandAtomicCmpXchg( + .addMBB(TailMBB); + + // .looptail: +- // dbar 0 + // andn scratch, dest, mask + // or scratch, scratch, newval + // sc.w|d scratch, scratch, (addr) + // beqz scratch, loophead + // b done +- BuildMI(LoopTailMBB, DL, TII->get(LoongArch::DBAR)).addImm(0); + BuildMI(LoopTailMBB, DL, TII->get(LoongArch::ANDN), ScratchReg) + .addReg(DestReg) + .addReg(MaskReg); +@@ -598,9 +571,24 @@ bool LoongArchExpandAtomicPseudo::expandAtomicCmpXchg( + BuildMI(LoopTailMBB, DL, TII->get(LoongArch::B)).addMBB(DoneMBB); + } + ++ AtomicOrdering Ordering = ++ static_cast<AtomicOrdering>(MI.getOperand(IsMasked ? 6 : 5).getImm()); ++ int hint; ++ ++ switch (Ordering) { ++ case AtomicOrdering::Acquire: ++ case AtomicOrdering::AcquireRelease: ++ case AtomicOrdering::SequentiallyConsistent: ++ // TODO: acquire ++ hint = 0; ++ break; ++ default: ++ hint = 0x700; ++ } ++ + // .tail: +- // dbar 0x700 +- BuildMI(TailMBB, DL, TII->get(LoongArch::DBAR)).addImm(0x700); ++ // dbar 0x700 | acquire ++ BuildMI(TailMBB, DL, TII->get(LoongArch::DBAR)).addImm(hint); + + NextMBBI = MBB.end(); + MI.eraseFromParent(); +diff --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td +index 05ae36a9781d..a9b0db30c2f6 100644 +--- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
View file
_service:tar_scm:0020-Update-llvm-lit-config-to-support-build_for_openeule.patch
Added
@@ -0,0 +1,30 @@ +From 5721be433ddee5f60d4a9434df43a023f1ec4c0e Mon Sep 17 00:00:00 2001 +From: wangqiang <wangqiang1@kylinos.cn> +Date: Sun, 28 Apr 2024 14:30:34 +0800 +Subject: PATCH Update llvm-lit config to support build_for_openeuler + +--- + llvm/cmake/modules/HandleLLVMOptions.cmake | 7 +++++++ + 1 files changed, 7 insertions(+) + +diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake +index 76723be69..c6f5569af 100644 +--- a/llvm/cmake/modules/HandleLLVMOptions.cmake ++++ b/llvm/cmake/modules/HandleLLVMOptions.cmake +@@ -97,6 +97,13 @@ if( LLVM_ENABLE_ASSERTIONS ) + set(LLVM_ENABLE_CLASSIC_FLANG 0) + endif() + ++option(BUILD_FOR_OPENEULER "Build support for openeuler" OFF) ++if(BUILD_FOR_OPENEULER) ++ set(BUILD_FOR_OPENEULER 1) ++else() ++ set(BUILD_FOR_OPENEULER 0) ++endif() ++ + if(LLVM_ENABLE_EXPENSIVE_CHECKS) + add_compile_definitions(EXPENSIVE_CHECKS) + +-- +2.33.0 +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2