[llvm-branch-commits] [libcxx] 8dbe13f - [libcxx] Support Python 3.8 in the test suite
Author: Sergej Jaskiewicz Date: 2020-02-19T10:32:36+01:00 New Revision: 8dbe13ff509c60dececd9d93f7ffe86c5c4456a0 URL: https://github.com/llvm/llvm-project/commit/8dbe13ff509c60dececd9d93f7ffe86c5c4456a0 DIFF: https://github.com/llvm/llvm-project/commit/8dbe13ff509c60dececd9d93f7ffe86c5c4456a0.diff LOG: [libcxx] Support Python 3.8 in the test suite Summary: `platform.linux_distribution()` has been deprecated in Python 3.5 and removed in Python 3.8. Reviewers: bcain, bcraig, jroelofs, EricWF, mclow.lists, ldionne Reviewed By: jroelofs Subscribers: dexonsmith, christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D72501 (cherry picked from commit 7b8dc8c57697e95fd0b1248e4494ecc0f929aba1) Added: Modified: libcxx/utils/libcxx/test/target_info.py Removed: diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py index d622daa2a871..fa57a2c7485d 100644 --- a/libcxx/utils/libcxx/test/target_info.py +++ b/libcxx/utils/libcxx/test/target_info.py @@ -207,15 +207,25 @@ def __init__(self, full_config): def platform(self): return 'linux' +def _distribution(self): +try: +# linux_distribution is not available since Python 3.8 +# However, this function is only used to detect SLES 11, +# which is quite an old distribution that doesn't have +# Python 3.8. +return platform.linux_distribution() +except AttributeError: +return '', '', '' + def platform_name(self): -name, _, _ = platform.linux_distribution() +name, _, _ = self._distribution() # Some distros have spaces, e.g. 'SUSE Linux Enterprise Server' # lit features can't have spaces name = name.lower().strip().replace(' ', '-') return name # Permitted to be None def platform_ver(self): -_, ver, _ = platform.linux_distribution() +_, ver, _ = self._distribution() ver = ver.lower().strip().replace(' ', '-') return ver # Permitted to be None. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] cd5006d - PR44890: Inherit explicitly-specified template arguments into base class
Author: Richard Smith Date: 2020-02-19T12:57:27+01:00 New Revision: cd5006d09d0e646b3aaab7bf5ad21407574f93c0 URL: https://github.com/llvm/llvm-project/commit/cd5006d09d0e646b3aaab7bf5ad21407574f93c0 DIFF: https://github.com/llvm/llvm-project/commit/cd5006d09d0e646b3aaab7bf5ad21407574f93c0.diff LOG: PR44890: Inherit explicitly-specified template arguments into base class deduction. (cherry picked from commit 34bd51f4b1d9f489e61becb662bdc72bb56dd277) Added: Modified: clang/include/clang/Sema/TemplateDeduction.h clang/lib/Sema/SemaTemplateDeduction.cpp clang/test/SemaTemplate/deduction.cpp Removed: diff --git a/clang/include/clang/Sema/TemplateDeduction.h b/clang/include/clang/Sema/TemplateDeduction.h index f787c2689d85..c0af9f3260b6 100644 --- a/clang/include/clang/Sema/TemplateDeduction.h +++ b/clang/include/clang/Sema/TemplateDeduction.h @@ -67,6 +67,13 @@ class TemplateDeductionInfo { TemplateDeductionInfo(const TemplateDeductionInfo &) = delete; TemplateDeductionInfo &operator=(const TemplateDeductionInfo &) = delete; + enum ForBaseTag { ForBase }; + /// Create temporary template deduction info for speculatively deducing + /// against a base class of an argument's type. + TemplateDeductionInfo(ForBaseTag, const TemplateDeductionInfo &Info) + : Deduced(Info.Deduced), Loc(Info.Loc), DeducedDepth(Info.DeducedDepth), +ExplicitArgs(Info.ExplicitArgs) {} + /// Returns the location at which template argument is /// occurring. SourceLocation getLocation() const { diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 6b865a601f9d..1e321d637910 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1818,7 +1818,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, // If this is a base class, try to perform template argument // deduction from it. if (NextT != RecordT) { - TemplateDeductionInfo BaseInfo(Info.getLocation()); + TemplateDeductionInfo BaseInfo(TemplateDeductionInfo::ForBase, Info); Sema::TemplateDeductionResult BaseResult = DeduceTemplateArguments(S, TemplateParams, SpecParam, QualType(NextT, 0), BaseInfo, Deduced); diff --git a/clang/test/SemaTemplate/deduction.cpp b/clang/test/SemaTemplate/deduction.cpp index 7268912dd6c5..5218543ab8a4 100644 --- a/clang/test/SemaTemplate/deduction.cpp +++ b/clang/test/SemaTemplate/deduction.cpp @@ -564,3 +564,20 @@ namespace nested_packs { } #endif } + +namespace PR44890 { + template +struct tuple {}; + + template +int get0(const tuple &t) { return 0; } + + template struct tuple_wrapper : tuple { +template int get() { return get0<0, Ts...>(*this); } + }; + + int f() { +tuple_wrapper w; +return w.get<0>(); + } +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3dee8be - llvm: Use quotes around MSVC_DIA_SDK_DIR CMake variable
Author: Cristian Adam Date: 2020-02-19T13:16:17+01:00 New Revision: 3dee8be1c3fe621b9c1926658f6c0df72ce804be URL: https://github.com/llvm/llvm-project/commit/3dee8be1c3fe621b9c1926658f6c0df72ce804be DIFF: https://github.com/llvm/llvm-project/commit/3dee8be1c3fe621b9c1926658f6c0df72ce804be.diff LOG: llvm: Use quotes around MSVC_DIA_SDK_DIR CMake variable MSVC_DIA_SDK_DIR variable will point to a path which contains spaces, and without quotes it will fail to configure the project. (cherry picked from commit d6fe253653b7e760f94ca21d0a7ebbf28777) Added: Modified: llvm/cmake/config-ix.cmake Removed: diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index a16038f70989..fc66dbfcbe7a 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -469,7 +469,7 @@ if( MSVC ) # though that we should handle it. We do so by simply checking that # the DIA SDK folder exists. Should this happen you will need to # uninstall VS 2012 and then re-install VS 2013. - if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR}) + if (IS_DIRECTORY "${MSVC_DIA_SDK_DIR}") set(HAVE_DIA_SDK 1) else() set(HAVE_DIA_SDK 0) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libunwind] 8de07c3 - Fix a -Wbitwise-conditional-parentheses warning in _LIBUNWIND_ARM_EHABI libunwind builds
Author: Nico Weber Date: 2020-02-19T13:27:51+01:00 New Revision: 8de07c31c1aafa848f515d721e6cf065a0701e81 URL: https://github.com/llvm/llvm-project/commit/8de07c31c1aafa848f515d721e6cf065a0701e81 DIFF: https://github.com/llvm/llvm-project/commit/8de07c31c1aafa848f515d721e6cf065a0701e81.diff LOG: Fix a -Wbitwise-conditional-parentheses warning in _LIBUNWIND_ARM_EHABI libunwind builds ``` src/UnwindCursor.hpp:1344:51: error: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Werror,-Wbitwise-conditional-parentheses] _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0; // Use enum? ~~~ ^ src/UnwindCursor.hpp:1344:51: note: place parentheses around the '|' expression to silence this warning _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0; // Use enum? ^ ( ) src/UnwindCursor.hpp:1344:51: note: place parentheses around the '?:' expression to evaluate it first _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0; // Use enum? ^ () ``` But `0 |` is a no-op for either of those two interpretations, so I think what was meant here was ``` _info.flags = (isSingleWordEHT ? 1 : 0) | (scope32 ? 0x2 : 0); // Use enum? ``` Previously, if `isSingleWordEHT` was set, bit 2 would never be set. Now it is. From what I can tell, the only thing that checks these bitmask is ProcessDescriptors in Unwind-EHABI.cpp, and that only cares about bit 1, so in practice this shouldn't have much of an effect. Differential Revision: https://reviews.llvm.org/D73890 (cherry picked from commit 221c5af4e4f4a504a4d1f352dd7b76d305e56a62) Added: Modified: libunwind/src/UnwindCursor.hpp Removed: diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 31be8366d238..e7fb70cc5718 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -1353,7 +1353,8 @@ bool UnwindCursor::getInfoFromEHABISection( // If the high bit is set, the exception handling table entry is inline inside // the index table entry on the second word (aka |indexDataAddr|). Otherwise, - // the table points at an offset in the exception handling table (section 5 EHABI). + // the table points at an offset in the exception handling table (section 5 + // EHABI). pint_t exceptionTableAddr; uint32_t exceptionTableData; bool isSingleWordEHT; @@ -1452,7 +1453,7 @@ bool UnwindCursor::getInfoFromEHABISection( _info.unwind_info = exceptionTableAddr; _info.lsda = lsda; // flags is pr_cache.additional. See EHABI #7.2 for definition of bit 0. - _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0; // Use enum? + _info.flags = (isSingleWordEHT ? 1 : 0) | (scope32 ? 0x2 : 0); // Use enum? return true; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 2db1f7f - Restore functionality of --sysroot on FreeBSD after b18cb9c47
Author: Dimitry Andric Date: 2020-02-19T13:29:12+01:00 New Revision: 2db1f7f59a276923138d2115dd7bcc5e70479b9c URL: https://github.com/llvm/llvm-project/commit/2db1f7f59a276923138d2115dd7bcc5e70479b9c DIFF: https://github.com/llvm/llvm-project/commit/2db1f7f59a276923138d2115dd7bcc5e70479b9c.diff LOG: Restore functionality of --sysroot on FreeBSD after b18cb9c47 After b18cb9c47, clang would sometimes prefer the host C++ includes (e.g. in /usr/include/c++/v1) before those specified via --sysroot. While this behavior may be desirable on Linux, it is not so on FreeBSD, where we make extensive use of --sysroot during the build of the base system. In that case, clang must *not* search outside the sysroot, except for its own internal headers. Add an override addLibCxxIncludePaths() to restore the old behavior, which is to simply append /usr/include/c++/v1 to the specified sysroot. While here, apply clang-format to the FreeBSD specific toolchain files. Fixes PR44923. (cherry picked from commit 62654cab7e654384ba503d6b62b1054cde19a553) Added: Modified: clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/FreeBSD.h Removed: diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp index c5c6f530f48c..6fb4ddd7f501 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -99,7 +99,8 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, case llvm::Triple::sparcel: case llvm::Triple::sparcv9: { std::string CPU = getCPUName(Args, getToolChain().getTriple()); -CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); +CmdArgs.push_back( +sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple())); AddAssemblerKPIC(getToolChain(), Args, CmdArgs); break; } @@ -388,6 +389,12 @@ unsigned FreeBSD::GetDefaultDwarfVersion() const { return 4; } +void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, +llvm::opt::ArgStringList &CC1Args) const { + addSystemInclude(DriverArgs, CC1Args, + getDriver().SysRoot + "/usr/include/c++/v1"); +} + void FreeBSD::addLibStdCxxIncludePaths( const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { diff --git a/clang/lib/Driver/ToolChains/FreeBSD.h b/clang/lib/Driver/ToolChains/FreeBSD.h index 84bdbfd9a312..7e13f48b7167 100644 --- a/clang/lib/Driver/ToolChains/FreeBSD.h +++ b/clang/lib/Driver/ToolChains/FreeBSD.h @@ -59,16 +59,18 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { bool IsObjCNonFragileABIDefault() const override { return true; } CXXStdlibType GetDefaultCXXStdlibType() const override; - void addLibStdCxxIncludePaths( - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; + void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + void + addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override; void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - llvm::ExceptionHandling GetExceptionModel( - const llvm::opt::ArgList &Args) const override; + llvm::ExceptionHandling + GetExceptionModel(const llvm::opt::ArgList &Args) const override; bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPIEDefault() const override; SanitizerMask getSupportedSanitizers() const override; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] be45a5a - [CodeGen][Tests] Fix b3cf70427eb1e97d9b89ba6e9298c280c8a32c74
Author: Clement Courbet Date: 2020-02-19T13:32:46+01:00 New Revision: be45a5a4092d678c992ac5d32e4b41da9367989a URL: https://github.com/llvm/llvm-project/commit/be45a5a4092d678c992ac5d32e4b41da9367989a DIFF: https://github.com/llvm/llvm-project/commit/be45a5a4092d678c992ac5d32e4b41da9367989a.diff LOG: [CodeGen][Tests] Fix b3cf70427eb1e97d9b89ba6e9298c280c8a32c74 Add missing lit.local.cfg in test/Transforms/CodeGenPrepare/PowerPC Added: llvm/test/Transforms/CodeGenPrepare/PowerPC/lit.local.cfg Modified: Removed: diff --git a/llvm/test/Transforms/CodeGenPrepare/PowerPC/lit.local.cfg b/llvm/test/Transforms/CodeGenPrepare/PowerPC/lit.local.cfg new file mode 100644 index ..091332439b18 --- /dev/null +++ b/llvm/test/Transforms/CodeGenPrepare/PowerPC/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'PowerPC' in config.root.targets: +config.unsupported = True ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a0fe9e0 - [SLPVectorizer] Do not assume extracelement idx is a ConstantInt.
Author: Florian Hahn Date: 2020-02-19T13:38:53+01:00 New Revision: a0fe9e0517637c97f4f282bd3b76f2406a6cc1b2 URL: https://github.com/llvm/llvm-project/commit/a0fe9e0517637c97f4f282bd3b76f2406a6cc1b2 DIFF: https://github.com/llvm/llvm-project/commit/a0fe9e0517637c97f4f282bd3b76f2406a6cc1b2.diff LOG: [SLPVectorizer] Do not assume extracelement idx is a ConstantInt. The index of an ExtractElementInst is not guaranteed to be a ConstantInt. It can be any integer value. Check explicitly for ConstantInts. The new test cases illustrate scenarios where we crash without this patch. I've also added another test case to check the matching of extractelement vector ops works. Reviewers: RKSimon, ABataev, dtemirbulatov, vporpo Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D74758 (cherry picked from commit e32522ca178acc42e26f21d64ef8fc180ad772bd) Added: Modified: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll Removed: diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 479bca83b51e..26cae4134ebc 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -832,13 +832,12 @@ class BoUpSLP { // Extracts from consecutive indexes of the same vector better score as // the extracts could be optimized away. - auto *Ex1 = dyn_cast(V1); - auto *Ex2 = dyn_cast(V2); - if (Ex1 && Ex2 && Ex1->getVectorOperand() == Ex2->getVectorOperand() && - cast(Ex1->getIndexOperand())->getZExtValue() + 1 == - cast(Ex2->getIndexOperand())->getZExtValue()) { + Value *EV; + ConstantInt *Ex1Idx, *Ex2Idx; + if (match(V1, m_ExtractElement(m_Value(EV), m_ConstantInt(Ex1Idx))) && + match(V2, m_ExtractElement(m_Deferred(EV), m_ConstantInt(Ex2Idx))) && + Ex1Idx->getZExtValue() + 1 == Ex2Idx->getZExtValue()) return VLOperands::ScoreConsecutiveExtracts; - } auto *I1 = dyn_cast(V1); auto *I2 = dyn_cast(V2); diff --git a/llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll b/llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll index 4217d7303750..751653089593 100644 --- a/llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll @@ -494,3 +494,153 @@ define void @ChecksExtractScores(double* %storeArray, double* %array, <2 x doubl store double %add1, double *%sidx1, align 8 ret void } + + +define i1 @ExtractIdxNotConstantInt1(float %a, float %b, float %c, <4 x float> %vec, i64 %idx2) { +; CHECK-LABEL: @ExtractIdxNotConstantInt1( +; CHECK-NEXT:[[VECEXT_I291_I166:%.*]] = extractelement <4 x float> [[VEC:%.*]], i64 undef +; CHECK-NEXT:[[SUB14_I167:%.*]] = fsub float undef, [[VECEXT_I291_I166]] +; CHECK-NEXT:[[FM:%.*]] = fmul float [[A:%.*]], [[SUB14_I167]] +; CHECK-NEXT:[[SUB25_I168:%.*]] = fsub float [[FM]], [[B:%.*]] +; CHECK-NEXT:[[VECEXT_I276_I169:%.*]] = extractelement <4 x float> [[VEC]], i64 [[IDX2:%.*]] +; CHECK-NEXT:[[ADD36_I173:%.*]] = fadd float [[SUB25_I168]], 1.00e+01 +; CHECK-NEXT:[[MUL72_I179:%.*]] = fmul float [[C:%.*]], [[VECEXT_I276_I169]] +; CHECK-NEXT:[[ADD78_I180:%.*]] = fsub float [[MUL72_I179]], 3.00e+01 +; CHECK-NEXT:[[ADD79_I181:%.*]] = fadd float 2.00e+00, [[ADD78_I180]] +; CHECK-NEXT:[[MUL123_I184:%.*]] = fmul float [[ADD36_I173]], [[ADD79_I181]] +; CHECK-NEXT:[[CMP_I185:%.*]] = fcmp ogt float [[MUL123_I184]], 0.00e+00 +; CHECK-NEXT:ret i1 [[CMP_I185]] +; + %vecext.i291.i166 = extractelement <4 x float> %vec, i64 undef + %sub14.i167 = fsub float undef, %vecext.i291.i166 + %fm = fmul float %a, %sub14.i167 + %sub25.i168 = fsub float %fm, %b + %vecext.i276.i169 = extractelement <4 x float> %vec, i64 %idx2 + %add36.i173 = fadd float %sub25.i168, 10.0 + %mul72.i179 = fmul float %c, %vecext.i276.i169 + %add78.i180 = fsub float %mul72.i179, 30.0 + %add79.i181 = fadd float 2.0, %add78.i180 + %mul123.i184 = fmul float %add36.i173, %add79.i181 + %cmp.i185 = fcmp ogt float %mul123.i184, 0.00e+00 + ret i1 %cmp.i185 +} + + +define i1 @ExtractIdxNotConstantInt2(float %a, float %b, float %c, <4 x float> %vec, i64 %idx2) { +; CHECK-LABEL: @ExtractIdxNotConstantInt2( +; CHECK-NEXT:[[VECEXT_I291_I166:%.*]] = extractelement <4 x float> [[VEC:%.*]], i64 1 +; CHECK-NEXT:[[SUB14_I167:%.*]] = fsub float undef, [[VECEXT_I291_I166]] +; CHECK-NEXT:[[FM:%.*]] = fmul float [[A:%.*]], [[SUB14_I167]] +; CHECK-NEXT:[[SUB25_I168:%.*]] = fsub float [[FM]], [[B:%.*]] +; CHECK-NEXT:[[VECEXT_I276_I169:%.*]] = extractelement <4 x float> [[VEC]], i64 [[IDX2:%.*]] +; CHECK-NEXT:[[ADD36_I173:%.*]] = fadd float [[SUB25_I168]], 1.00e+01 +; CHECK-NEXT:[[MUL72_I179:%.*]] = fmul
[llvm-branch-commits] [llvm] 222de78 - [X86CmovConversion] Make heuristic for optimized cmov depth more conservative (PR44539)
Author: Nikita Popov Date: 2020-02-19T14:03:13+01:00 New Revision: 222de784df453659144c6d07b530e7858c980021 URL: https://github.com/llvm/llvm-project/commit/222de784df453659144c6d07b530e7858c980021 DIFF: https://github.com/llvm/llvm-project/commit/222de784df453659144c6d07b530e7858c980021.diff LOG: [X86CmovConversion] Make heuristic for optimized cmov depth more conservative (PR44539) Fix/workaround for https://bugs.llvm.org/show_bug.cgi?id=44539. As discussed there, this pass makes some overly optimistic assumptions, as it does not have access to actual branch weights. This patch makes the computation of the depth of the optimized cmov more conservative, by assuming a distribution of 75/25 rather than 50/50 and placing the weights to get the more conservative result (larger depth). The fully conservative choice would be std::max(TrueOpDepth, FalseOpDepth), but that would break at least one existing test (which may or may not be an issue in practice). Differential Revision: https://reviews.llvm.org/D74155 (cherry picked from commit 5eb19bf4a2b0c29a8d4d48dfb0276f096eff9bec) Added: Modified: llvm/lib/Target/X86/X86CmovConversion.cpp Removed: diff --git a/llvm/lib/Target/X86/X86CmovConversion.cpp b/llvm/lib/Target/X86/X86CmovConversion.cpp index fe43bf4cbbce..fe5cb3ae2bf6 100644 --- a/llvm/lib/Target/X86/X86CmovConversion.cpp +++ b/llvm/lib/Target/X86/X86CmovConversion.cpp @@ -364,12 +364,13 @@ bool X86CmovConverterPass::collectCmovCandidates( /// \param TrueOpDepth depth cost of CMOV true value operand. /// \param FalseOpDepth depth cost of CMOV false value operand. static unsigned getDepthOfOptCmov(unsigned TrueOpDepth, unsigned FalseOpDepth) { - //======// - // With no info about branch weight, we assume 50% for each value operand. - // Thus, depth of optimized CMOV instruction is the rounded up average of - // its True-Operand-Value-Depth and False-Operand-Value-Depth. - //======// - return (TrueOpDepth + FalseOpDepth + 1) / 2; + // The depth of the result after branch conversion is + // TrueOpDepth * TrueOpProbability + FalseOpDepth * FalseOpProbability. + // As we have no info about branch weight, we assume 75% for one and 25% for + // the other, and pick the result with the largest resulting depth. + return std::max( + divideCeil(TrueOpDepth * 3 + FalseOpDepth, 4), + divideCeil(FalseOpDepth * 3 + TrueOpDepth, 4)); } bool X86CmovConverterPass::checkForProfitableCmovCandidates( ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra] d5f8656 - [clangd] Make output order of allTargetDecls deterministic
Author: Kadir Cetinkaya Date: 2020-02-19T14:08:13+01:00 New Revision: d5f8656a68c25e93c5c8f03e0670fecb16609d40 URL: https://github.com/llvm/llvm-project/commit/d5f8656a68c25e93c5c8f03e0670fecb16609d40 DIFF: https://github.com/llvm/llvm-project/commit/d5f8656a68c25e93c5c8f03e0670fecb16609d40.diff LOG: [clangd] Make output order of allTargetDecls deterministic Summary: Makes use of insertion order to stabilize output for multiple decls. Fixes https://bugs.llvm.org/show_bug.cgi?id=44564 Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, usaxena95, cfe-commits, aemerson Tags: #clang Differential Revision: https://reviews.llvm.org/D72826 (cherry picked from commit d54d71b67e602674a255e299a22fe31dee1f3619) Added: Modified: clang-tools-extra/clangd/FindTarget.cpp Removed: diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp index d8ce0b69283f..82a2e8c27d56 100644 --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -35,6 +35,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include +#include namespace clang { namespace clangd { @@ -134,6 +135,35 @@ const Type *getPointeeType(const Type *T) { return FirstArg.getAsType().getTypePtrOrNull(); } +const NamedDecl *getTemplatePattern(const NamedDecl *D) { + if (const CXXRecordDecl *CRD = dyn_cast(D)) { +return CRD->getTemplateInstantiationPattern(); + } else if (const FunctionDecl *FD = dyn_cast(D)) { +return FD->getTemplateInstantiationPattern(); + } else if (auto *VD = dyn_cast(D)) { +// Hmm: getTIP returns its arg if it's not an instantiation?! +VarDecl *T = VD->getTemplateInstantiationPattern(); +return (T == D) ? nullptr : T; + } else if (const auto *ED = dyn_cast(D)) { +return ED->getInstantiatedFromMemberEnum(); + } else if (isa(D) || isa(D)) { +if (const auto *Parent = llvm::dyn_cast(D->getDeclContext())) + if (const DeclContext *ParentPat = + dyn_cast_or_null(getTemplatePattern(Parent))) +for (const NamedDecl *BaseND : ParentPat->lookup(D->getDeclName())) + if (!BaseND->isImplicit() && BaseND->getKind() == D->getKind()) +return BaseND; + } else if (const auto *ECD = dyn_cast(D)) { +if (const auto *ED = dyn_cast(ECD->getDeclContext())) { + if (const EnumDecl *Pattern = ED->getInstantiatedFromMemberEnum()) { +for (const NamedDecl *BaseECD : Pattern->lookup(ECD->getDeclName())) + return BaseECD; + } +} + } + return nullptr; +} + // TargetFinder locates the entities that an AST node refers to. // // Typically this is (possibly) one declaration and (possibly) one type, but @@ -167,37 +197,12 @@ const Type *getPointeeType(const Type *T) { struct TargetFinder { using RelSet = DeclRelationSet; using Rel = DeclRelation; - llvm::SmallDenseMap Decls; - RelSet Flags; - static const NamedDecl *getTemplatePattern(const NamedDecl *D) { -if (const CXXRecordDecl *CRD = dyn_cast(D)) { - return CRD->getTemplateInstantiationPattern(); -} else if (const FunctionDecl *FD = dyn_cast(D)) { - return FD->getTemplateInstantiationPattern(); -} else if (auto *VD = dyn_cast(D)) { - // Hmm: getTIP returns its arg if it's not an instantiation?! - VarDecl *T = VD->getTemplateInstantiationPattern(); - return (T == D) ? nullptr : T; -} else if (const auto *ED = dyn_cast(D)) { - return ED->getInstantiatedFromMemberEnum(); -} else if (isa(D) || isa(D)) { - if (const auto *Parent = llvm::dyn_cast(D->getDeclContext())) -if (const DeclContext *ParentPat = -dyn_cast_or_null(getTemplatePattern(Parent))) - for (const NamedDecl *BaseND : ParentPat->lookup(D->getDeclName())) -if (!BaseND->isImplicit() && BaseND->getKind() == D->getKind()) - return BaseND; -} else if (const auto *ECD = dyn_cast(D)) { - if (const auto *ED = dyn_cast(ECD->getDeclContext())) { -if (const EnumDecl *Pattern = ED->getInstantiatedFromMemberEnum()) { - for (const NamedDecl *BaseECD : Pattern->lookup(ECD->getDeclName())) -return BaseECD; -} - } -} -return nullptr; - } +private: + llvm::SmallDenseMap> + Decls; + RelSet Flags; template void debug(T &Node, RelSet Flags) { dlog("visit [{0}] {1}", Flags, @@ -207,10 +212,22 @@ struct TargetFinder { void report(const NamedDecl *D, RelSet Flags) { dlog("--> [{0}] {1}", Flags, nodeToString(ast_type_traits::DynTypedNode::create(*D))); -Decls[D] |= Flags; +auto It = Decls.try_emplace(D, std::make_pair(Flags, Decls.size())); +// If already exists, update the flags. +if (!It.second) + It.first->second.first |= Flags; } public: + llvm::SmallVector, 1> takeDe
[llvm-branch-commits] [lldb] 7751f0c - Add testing for DW_OP_piece and fix a bug with small Scalar values.
Author: Adrian Prantl Date: 2020-02-19T14:20:33+01:00 New Revision: 7751f0c191518b377d9b71bdd17281abec83945a URL: https://github.com/llvm/llvm-project/commit/7751f0c191518b377d9b71bdd17281abec83945a DIFF: https://github.com/llvm/llvm-project/commit/7751f0c191518b377d9b71bdd17281abec83945a.diff LOG: Add testing for DW_OP_piece and fix a bug with small Scalar values. By switching to Scalars that are backed by explicitly-sized APInts we can avoid a bug that increases the buffer reserved for a small piece to the next-largest host integer type. This manifests as "DW_OP_piece for offset foo but top of stack is of size bar". Differential Revision: https://reviews.llvm.org/D72879 (cherry picked from commit 7b0d58e339b271e3b1d9dc14b781b57fa0262e3a) Added: Modified: lldb/source/Expression/DWARFExpression.cpp lldb/unittests/Expression/DWARFExpressionTest.cpp Removed: diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 69c84640ef93..0f8eea754c24 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -2128,7 +2128,8 @@ bool DWARFExpression::Evaluate( case Value::eValueTypeScalar: { uint32_t bit_size = piece_byte_size * 8; uint32_t bit_offset = 0; -if (!curr_piece_source_value.GetScalar().ExtractBitfield( +Scalar &scalar = curr_piece_source_value.GetScalar(); +if (!scalar.ExtractBitfield( bit_size, bit_offset)) { if (error_ptr) error_ptr->SetErrorStringWithFormat( @@ -2139,7 +2140,14 @@ bool DWARFExpression::Evaluate( .GetByteSize()); return false; } -curr_piece = curr_piece_source_value; +// Create curr_piece with bit_size. By default Scalar +// grows to the nearest host integer type. +llvm::APInt fail_value(1, 0, false); +llvm::APInt ap_int = scalar.UInt128(fail_value); +assert(ap_int.getBitWidth() >= bit_size); +llvm::ArrayRef buf{ap_int.getRawData(), + ap_int.getNumWords()}; +curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf)); } break; case Value::eValueTypeVector: { @@ -2161,7 +2169,7 @@ bool DWARFExpression::Evaluate( if (op_piece_offset == 0) { // This is the first piece, we should push it back onto the stack // so subsequent pieces will be able to access this piece and add -// to it +// to it. if (pieces.AppendDataToHostBuffer(curr_piece) == 0) { if (error_ptr) error_ptr->SetErrorString("failed to append piece data"); @@ -2169,7 +2177,7 @@ bool DWARFExpression::Evaluate( } } else { // If this is the second or later piece there should be a value on -// the stack +// the stack. if (pieces.GetBuffer().GetByteSize() != op_piece_offset) { if (error_ptr) error_ptr->SetErrorStringWithFormat( diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp index 8fad88a93e11..fe5e9c957ba0 100644 --- a/lldb/unittests/Expression/DWARFExpressionTest.cpp +++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp @@ -37,7 +37,22 @@ static llvm::Expected Evaluate(llvm::ArrayRef expr, /*object_address_ptr*/ nullptr, result, &status)) return status.ToError(); - return result.GetScalar(); + switch (result.GetValueType()) { + case Value::eValueTypeScalar: +return result.GetScalar(); + case Value::eValueTypeHostAddress: { +// Convert small buffers to scalars to simplify the tests. +DataBufferHeap &buf = result.GetBuffer(); +if (buf.GetByteSize() <= 8) { + uint64_t val = 0; + memcpy(&val, buf.GetBytes(), buf.GetByteSize()); + return Scalar(llvm::APInt(buf.GetByteSize()*8, val, false)); +} + } +LLVM_FALLTHROUGH; + default: +return status.ToError(); + } } /// A mock module holding an object file parsed from YAML. @@ -335,3 +350,9 @@ TEST(DWARFExpression, DW_OP_convert) { t.Eval({DW_OP_const1s, 'X', DW_OP_convert, 0x1d}).takeError(), llvm::Failed()); } + +TEST(DWARFExpression, DW_OP_piece) { + EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2, + DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}), + llvm::HasValue(GetScalar(32, 0x44332211, true))); +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] cab8152 - Fix a buffer-size bug when the first DW_OP_piece is undefined
Author: Adrian Prantl Date: 2020-02-19T14:20:34+01:00 New Revision: cab81521b5afc2d4295f988aa5f087cbaeefb981 URL: https://github.com/llvm/llvm-project/commit/cab81521b5afc2d4295f988aa5f087cbaeefb981 DIFF: https://github.com/llvm/llvm-project/commit/cab81521b5afc2d4295f988aa5f087cbaeefb981.diff LOG: Fix a buffer-size bug when the first DW_OP_piece is undefined and document the shortcomings of LLDB's partially defined DW_OP_piece handling. This would manifest as "DW_OP_piece for offset foo but top of stack is of size bar". rdar://problem/46262998 Differential Revision: https://reviews.llvm.org/D72880 (cherry picked from commit f55ab6f90b7317a6bb85303a6102702bdae1199e) Added: Modified: lldb/source/Expression/DWARFExpression.cpp lldb/unittests/Expression/DWARFExpressionTest.cpp Removed: diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 0f8eea754c24..08cc70c201fe 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -2071,6 +2071,10 @@ bool DWARFExpression::Evaluate( // not available. Fill with zeros for now by resizing the data and // appending it curr_piece.ResizeData(piece_byte_size); + // Note that "0" is not a correct value for the unknown bits. + // It would be better to also return a mask of valid bits together + // with the expression result, so the debugger can print missing + // members as "" or something. ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size); pieces.AppendDataToHostBuffer(curr_piece); } else { @@ -2193,8 +2197,8 @@ bool DWARFExpression::Evaluate( return false; } } - op_piece_offset += piece_byte_size; } +op_piece_offset += piece_byte_size; } } break; diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp index fe5e9c957ba0..45876152f029 100644 --- a/lldb/unittests/Expression/DWARFExpressionTest.cpp +++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp @@ -355,4 +355,9 @@ TEST(DWARFExpression, DW_OP_piece) { EXPECT_THAT_EXPECTED(Evaluate({DW_OP_const2u, 0x11, 0x22, DW_OP_piece, 2, DW_OP_const2u, 0x33, 0x44, DW_OP_piece, 2}), llvm::HasValue(GetScalar(32, 0x44332211, true))); + EXPECT_THAT_EXPECTED( + Evaluate({DW_OP_piece, 1, DW_OP_const1u, 0xff, DW_OP_piece, 1}), + // Note that the "00" should really be "undef", but we can't + // represent that yet. + llvm::HasValue(GetScalar(16, 0xff00, true))); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5f76fcc - Fix unused function warning (PR44808)
Author: Hans Wennborg Date: 2020-02-19T14:24:33+01:00 New Revision: 5f76fcc9796e1a68f44a79b7910a199c0db9fe82 URL: https://github.com/llvm/llvm-project/commit/5f76fcc9796e1a68f44a79b7910a199c0db9fe82 DIFF: https://github.com/llvm/llvm-project/commit/5f76fcc9796e1a68f44a79b7910a199c0db9fe82.diff LOG: Fix unused function warning (PR44808) (cherry picked from commit a19de32095e4cdb18957e66609574ce2021a8d1c) Added: Modified: llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp index 05c81feb23ec..c4f511abc4ae 100644 --- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp +++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp @@ -244,11 +244,6 @@ static raw_ostream& operator<<(raw_ostream &OS, const DstUnused &Un) { return OS; } -static raw_ostream& operator<<(raw_ostream &OS, const SDWAOperand &Operand) { - Operand.print(OS); - return OS; -} - LLVM_DUMP_METHOD void SDWASrcOperand::print(raw_ostream& OS) const { OS << "SDWA src: " << *getTargetOperand() @@ -850,6 +845,13 @@ SIPeepholeSDWA::matchSDWAOperand(MachineInstr &MI) { return std::unique_ptr(nullptr); } +#if !defined(NDEBUG) +static raw_ostream& operator<<(raw_ostream &OS, const SDWAOperand &Operand) { + Operand.print(OS); + return OS; +} +#endif + void SIPeepholeSDWA::matchSDWAOperands(MachineBasicBlock &MBB) { for (MachineInstr &MI : MBB) { if (auto Operand = matchSDWAOperand(MI)) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 5175565 - Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang
Author: Richard Smith Date: 2020-02-19T13:37:59-08:00 New Revision: 5175565cf154aede57354336102a7f6e15a16a20 URL: https://github.com/llvm/llvm-project/commit/5175565cf154aede57354336102a7f6e15a16a20 DIFF: https://github.com/llvm/llvm-project/commit/5175565cf154aede57354336102a7f6e15a16a20.diff LOG: Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang user interface and documentation, and update __cplusplus for C++20. WG21 considers the C++20 standard to be finished (even though it still has some more steps to pass through in the ISO process). The old flag names are accepted for compatibility, as usual, and we still have lots of references to C++2a in comments and identifiers; those can be cleaned up separately. (cherry picked from commit 24ad121582454e625bdad125c90d9ac0dae948c8) Added: Modified: clang/docs/LanguageExtensions.rst clang/include/clang/Basic/DiagnosticASTKinds.td clang/include/clang/Basic/DiagnosticCommonKinds.td clang/include/clang/Basic/DiagnosticFrontendKinds.td clang/include/clang/Basic/DiagnosticGroups.td clang/include/clang/Basic/DiagnosticLexKinds.td clang/include/clang/Basic/DiagnosticParseKinds.td clang/include/clang/Basic/DiagnosticSemaKinds.td clang/include/clang/Basic/LangStandards.def clang/include/clang/Basic/StmtNodes.td clang/lib/Frontend/InitPreprocessor.cpp clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp clang/test/CXX/drs/dr2xx.cpp clang/test/CXX/drs/dr6xx.cpp clang/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp clang/test/Driver/unknown-std.cpp clang/test/Lexer/cxx2a-spaceship.cpp clang/test/Lexer/cxx2a_keyword_as_cxx17.cpp clang/test/Parser/cxx1z-decomposition.cpp clang/test/Parser/cxx2a-concept-declaration.cpp clang/test/Parser/cxx2a-inline-nested-namespace-definition.cpp clang/test/Parser/explicit-bool.cpp clang/test/Preprocessor/init.c clang/test/SemaCXX/cxx17-compat.cpp clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp clang/test/SemaCXX/cxx1z-decomposition.cpp clang/test/SemaCXX/cxx2a-compat.cpp clang/test/SemaCXX/cxx2a-initializer-aggregates.cpp clang/test/SemaCXX/member-init.cpp clang/www/cxx_status.html Removed: diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index f1df9dd93f93..456bcb305e3b 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -122,7 +122,7 @@ of ``cxx_rvalue_references``. ``__has_cpp_attribute`` --- -This function-like macro is available in C++2a by default, and is provided as an +This function-like macro is available in C++20 by default, and is provided as an extension in earlier language standards. It takes a single argument that is the name of a double-square-bracket-style attribute. The argument can either be a single identifier or a scoped identifier. If the attribute is supported, a diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td index 95505b00344f..a0c15ba1cb05 100644 --- a/clang/include/clang/Basic/DiagnosticASTKinds.td +++ b/clang/include/clang/Basic/DiagnosticASTKinds.td @@ -13,7 +13,7 @@ def note_expr_divide_by_zero : Note<"division by zero">; def note_constexpr_invalid_cast : Note< "%select{reinterpret_cast|dynamic_cast|cast that performs the conversions of" " a reinterpret_cast|cast from %1}0 is not allowed in a constant expression" - "%select{| in C++ standards before C++2a||}0">; + "%select{| in C++ standards before C++20||}0">; def note_constexpr_invalid_downcast : Note< "cannot cast object of dynamic type %0 to type %1">; def note_constexpr_overflow : Note< @@ -33,7 +33,7 @@ def note_constexpr_no_return : Note< "control reached end of constexpr function">; def note_constexpr_virtual_call : Note< "cannot evaluate call to virtual function in a constant expression " - "in C++ standards before C++2a">; + "in C++ standards before C++20">; def note_constexpr_pure_virtual_call : Note< "pure virtual function %q0 called">; def note_constexpr_polymorphic_unknown_dynamic_type : Note< @@ -102,7 +102,7 @@ def note_constexpr_var_init_non_constant : Note< "initializer of %0 is not a constant expression">; def note_constexpr_typeid_polymorphic : Note< "typeid applied to expression of polymorphic type %0 is " - "not allowed in a constant expression in C++ standards before C++2a">; + "not allowed in a constant expression in C++ standards before C++20">; def note_constexpr_void_comparison : Note< "comparison between unequal pointers to void has unspecified r
[llvm-branch-commits] [llvm] f004359 - [windows] Add /Gw to compiler flags
Author: Nico Weber Date: 2020-02-20T08:50:54+01:00 New Revision: f004359106cfda578733dff1380560b68f9c3713 URL: https://github.com/llvm/llvm-project/commit/f004359106cfda578733dff1380560b68f9c3713 DIFF: https://github.com/llvm/llvm-project/commit/f004359106cfda578733dff1380560b68f9c3713.diff LOG: [windows] Add /Gw to compiler flags This is like -fdata-sections, and it's not part of /O2 by default for some reason. In the cmake build, reduces the size of clang.exe from 70,358,016 bytes to 69,982,720 bytes. clang-format.exe goes from 3,703,296 bytes to 3,331,072 bytes. Differential Revision: https://reviews.llvm.org/D74573 (cherry picked from commit 09153ab9d267a86d6e9bce18d5074617de5879a5) Added: Modified: llvm/cmake/modules/HandleLLVMOptions.cmake llvm/utils/gn/build/BUILD.gn Removed: diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index ab219e52f9d9..30f04ca34c2c 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -788,6 +788,10 @@ if(NOT CYGWIN AND NOT WIN32) endif() add_flag_if_supported("-fdata-sections" FDATA_SECTIONS) endif() +elseif(MSVC) + if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) +append("/Gw" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endif() endif() if(MSVC) diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn index b06ef9ad83e3..b74268996f15 100644 --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -60,6 +60,7 @@ config("compiler_defaults") { if (is_optimized) { cflags += [ "/O2", +"/Gw", "/Zc:inline", ] ldflags += [ ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits