r270970 - [AVX512][Builtin] Fix palignr intrinsic for avx512vlbw. The immediate should not be multiplied by 8.
Author: ctopper Date: Fri May 27 01:59:39 2016 New Revision: 270970 URL: http://llvm.org/viewvc/llvm-project?rev=270970&view=rev Log: [AVX512][Builtin] Fix palignr intrinsic for avx512vlbw. The immediate should not be multiplied by 8. The 512-bit version was fixed recently but this was missed. Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=270970&r1=270969&r2=270970&view=diff == --- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original) +++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Fri May 27 01:59:39 2016 @@ -3338,25 +3338,25 @@ _mm256_mask_permutexvar_epi16 (__m256i _ #define _mm_mask_alignr_epi8(W, U, A, B, N) __extension__ ({ \ (__m128i)__builtin_ia32_palignr128_mask((__v16qi)(__m128i)(A), \ - (__v16qi)(__m128i)(B), (int)(N) * 8, \ + (__v16qi)(__m128i)(B), (int)(N), \ (__v16qi)(__m128i)(W), \ (__mmask16)(U)); }) #define _mm_maskz_alignr_epi8(U, A, B, N) __extension__ ({ \ (__m128i)__builtin_ia32_palignr128_mask((__v16qi)(__m128i)(A), \ - (__v16qi)(__m128i)(B), (int)(N) * 8, \ + (__v16qi)(__m128i)(B), (int)(N), \ (__v16qi)_mm_setzero_si128(), \ (__mmask16)(U)); }) #define _mm256_mask_alignr_epi8(W, U, A, B, N) __extension__ ({ \ (__m256i)__builtin_ia32_palignr256_mask((__v32qi)(__m256i)(A), \ - (__v32qi)(__m256i)(B), (int)(N) * 8, \ + (__v32qi)(__m256i)(B), (int)(N), \ (__v32qi)(__m256i)(W), \ (__mmask32)(U)); }) #define _mm256_maskz_alignr_epi8(U, A, B, N) __extension__ ({ \ (__m256i)__builtin_ia32_palignr256_mask((__v32qi)(__m256i)(A), \ - (__v32qi)(__m256i)(B), (int)(N) * 8, \ + (__v32qi)(__m256i)(B), (int)(N), \ (__v32qi)_mm256_setzero_si256(), \ (__mmask32)(U)); }) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r270707 - [Clang][AVX512][Builtin] Fix palignr intrinsics header
The same bug existed in avx512vlbwintrin.h too. Fixed in r270970. On Wed, May 25, 2016 at 8:05 AM, Michael Zuckerman via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: mzuckerm > Date: Wed May 25 10:05:03 2016 > New Revision: 270707 > > URL: http://llvm.org/viewvc/llvm-project?rev=270707&view=rev > Log: > [Clang][AVX512][Builtin] Fix palignr intrinsics header > > Differential Revision: http://reviews.llvm.org/D20620 > > Modified: > cfe/trunk/lib/Headers/avx512bwintrin.h > > Modified: cfe/trunk/lib/Headers/avx512bwintrin.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=270707&r1=270706&r2=270707&view=diff > > == > --- cfe/trunk/lib/Headers/avx512bwintrin.h (original) > +++ cfe/trunk/lib/Headers/avx512bwintrin.h Wed May 25 10:05:03 2016 > @@ -2145,19 +2145,19 @@ _mm512_mask_permutexvar_epi16 (__m512i _ > > #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ >(__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ > - (__v64qi)(__m512i)(B), (int)(N) > * 8, \ > + (__v64qi)(__m512i)(B), > (int)(N), \ >(__v64qi)_mm512_undefined_pd(), > \ >(__mmask64)-1); }) > > #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ >(__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ > - (__v64qi)(__m512i)(B), (int)(N) > * 8, \ > + (__v64qi)(__m512i)(B), > (int)(N), \ >(__v64qi)(__m512i)(W), \ >(__mmask64)(U)); }) > > #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ >(__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ > - (__v64qi)(__m512i)(B), (int)(N) > * 8, \ > + (__v64qi)(__m512i)(B), > (int)(N), \ > > (__v64qi)_mm512_setzero_si512(), \ >(__mmask64)(U)); }) > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- ~Craig ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20715: [docs] Document the source-based code coverage feature
silvas added subscribers: MaggieYi, phillip.power. silvas added a comment. This is looking really good. So based on reading this, a rough sketch of how we can expand this to PGO would be something like: - there is a separate PGO page that has similar structure, but is more tuned for the PGO use case. - there is a separate page (maybe in the LLVM docs and not clang since other frontends might be using libprofile?) which describes "advanced usage of the profile runtime". That would cover the file and buffer API, `__llvm_profile_runtime`, runtime counter resetting and merging, etc. Adding Maggie and Phillip, which are working on coverage at PlayStation. Comment at: docs/SourceBasedCodeCoverage.rst:33 @@ +32,3 @@ + +3. Create a report out of the generated profile. + Would it be possible to make these consistent with the later section headers? Comment at: docs/SourceBasedCodeCoverage.rst:61 @@ +60,3 @@ +# Step 1: Compile with coverage enabled. +% cc -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo + Since these are clang's docs, we should just say `clang` (or `clang++`) Comment at: docs/SourceBasedCodeCoverage.rst:91 @@ +90,3 @@ +Raw profiles have to be **indexed** before they can be used to generated +coverage reports: + As a user, this would make me ask "why can't llvm-profdata do the indexing if I pass it a raw profile"? I think the answer is largely that in a real program there are multiple profraws, so you need to merge them first. You probably want to mention that. Comment at: docs/SourceBasedCodeCoverage.rst:140 @@ +139,3 @@ +# Step 3(c): Create a coverage summary. +% llvm-cov report ./foo -instr-profile=foo.profdata + Can you show example output? That is one of the most useful things in a how-to document like this. (for example, a person reading this might be a prospective user of the feature, and seeing the output is valuable to them to see if it provides what they want) Comment at: docs/SourceBasedCodeCoverage.rst:149 @@ +148,3 @@ +* Raw profiles can be discarded after they are indexed. It **is** possible for + instrumented programs to merge profiling information directly into an existing + raw profile on disk. The details are out of this document's scope. Small wording nit: Instead of saying "It is possible for an instrumented program to..." I would say something like "Advanced use of the profile runtime library allows an instrumented program to..." or something like that. http://reviews.llvm.org/D20715 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270971 - [clang-format] moved unit tests related to replacements cleaner from FormatTest.cpp to CleanUpTest.cpp.
Author: ioeric Date: Fri May 27 03:20:02 2016 New Revision: 270971 URL: http://llvm.org/viewvc/llvm-project?rev=270971&view=rev Log: [clang-format] moved unit tests related to replacements cleaner from FormatTest.cpp to CleanUpTest.cpp. Modified: cfe/trunk/unittests/Format/CleanupTest.cpp cfe/trunk/unittests/Format/FormatTest.cpp Modified: cfe/trunk/unittests/Format/CleanupTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CleanupTest.cpp?rev=270971&r1=270970&r2=270971&view=diff == --- cfe/trunk/unittests/Format/CleanupTest.cpp (original) +++ cfe/trunk/unittests/Format/CleanupTest.cpp Fri May 27 03:20:02 2016 @@ -9,6 +9,7 @@ #include "clang/Format/Format.h" +#include "../Tooling/RewriterTestContext.h" #include "clang/Tooling/Core/Replacement.h" #include "gtest/gtest.h" @@ -240,6 +241,46 @@ TEST_F(CleanupTest, CtorInitializerInNam EXPECT_EQ(Expected, Result); } +class CleanUpReplacementsTest : public ::testing::Test { +protected: + tooling::Replacement createReplacement(SourceLocation Start, unsigned Length, + llvm::StringRef ReplacementText) { +return tooling::Replacement(Context.Sources, Start, Length, +ReplacementText); + } + + RewriterTestContext Context; +}; + +TEST_F(CleanUpReplacementsTest, FixOnlyAffectedCodeAfterReplacements) { + std::string Code = "namespace A {\n" + "namespace B {\n" + " int x;\n" + "} // namespace B\n" + "} // namespace A\n" + "\n" + "namespace C {\n" + "namespace D { int i; }\n" + "inline namespace E { namespace { int y; } }\n" + "int x= 0;" + "}"; + std::string Expected = "\n\nnamespace C {\n" + "namespace D { int i; }\n\n" + "int x= 0;" + "}"; + FileID ID = Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement(Context.Sources, + Context.getLocation(ID, 3, 3), 6, "")); + Replaces.insert(tooling::Replacement(Context.Sources, + Context.getLocation(ID, 9, 34), 6, "")); + + format::FormatStyle Style = format::getLLVMStyle(); + auto FinalReplaces = formatReplacements( + Code, cleanupAroundReplacements(Code, Replaces, Style), Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, FinalReplaces)); +} + } // end namespace } // end namespace format } // end namespace clang Modified: cfe/trunk/unittests/Format/FormatTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=270971&r1=270970&r2=270971&view=diff == --- cfe/trunk/unittests/Format/FormatTest.cpp (original) +++ cfe/trunk/unittests/Format/FormatTest.cpp Fri May 27 03:20:02 2016 @@ -11537,35 +11537,6 @@ TEST_F(ReplacementTest, FormatCodeAfterR Code, formatReplacements(Code, Replaces, Style))); } -TEST_F(ReplacementTest, FixOnlyAffectedCodeAfterReplacements) { - std::string Code = "namespace A {\n" - "namespace B {\n" - " int x;\n" - "} // namespace B\n" - "} // namespace A\n" - "\n" - "namespace C {\n" - "namespace D { int i; }\n" - "inline namespace E { namespace { int y; } }\n" - "int x= 0;" - "}"; - std::string Expected = "\n\nnamespace C {\n" - "namespace D { int i; }\n\n" - "int x= 0;" - "}"; - FileID ID = Context.createInMemoryFile("fix.cpp", Code); - tooling::Replacements Replaces; - Replaces.insert(tooling::Replacement( - Context.Sources, Context.getLocation(ID, 3, 3), 6, "")); - Replaces.insert(tooling::Replacement( - Context.Sources, Context.getLocation(ID, 9, 34), 6, "")); - - format::FormatStyle Style = format::getLLVMStyle(); - auto FinalReplaces = formatReplacements( - Code, cleanupAroundReplacements(Code, Replaces, Style), Style); - EXPECT_EQ(Expected, applyAllReplacements(Code, FinalReplaces)); -} - TEST_F(ReplacementTest, SortIncludesAfterReplacement) { std::string Code = "#include \"a.h\"\n" "#include \"c.h\"\n" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r270972 - [libunwind] Disable cross-unwinding by default.
Author: asiri Date: Fri May 27 03:29:27 2016 New Revision: 270972 URL: http://llvm.org/viewvc/llvm-project?rev=270972&view=rev Log: [libunwind] Disable cross-unwinding by default. Cross unwinding requires larger sizes for unw_context_t and unw_cursor_t buffers (large enough to hold the VRS of any architecture). This is not desirable for the most common situation where libunwind is used for native unwinding only. This patch makes native unwinding the default build configuration. This will start testing the tigher (compile-time) bounds of unw_context_t and unw_cursor_t buffers for each architecture. Change-Id: Ic61c476a75603ca4812959c233cfe56f83dc0b00 Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=270972&r1=270971&r2=270972&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Fri May 27 03:29:27 2016 @@ -103,7 +103,7 @@ option(LIBUNWIND_ENABLE_ASSERTIONS "Enab option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON) -option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." ON) +option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." OFF) set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross compiling.") set(LIBUNWIND_SYSROOT "" CACHE STRING "Sysroot for cross compiling.") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
Thanks. r270962 seems to have fixed the buildbot. > -Original Message- > From: Daniel Sanders > Sent: 26 May 2016 16:24 > To: 'Alexey Bataev'; cfe-commits@lists.llvm.org > Subject: RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' > allowing choosing > > Hi, > > I think this commit may have caused the failure in > http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/13743. Could you > check? Buildbot will have supressed the usual email because the previous > build failed (for a different reason). > > > -Original Message- > > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf > > Of Alexey Bataev via cfe-commits > > Sent: 26 May 2016 12:10 > > To: cfe-commits@lists.llvm.org > > Subject: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' > > allowing choosing > > > > Author: abataev > > Date: Thu May 26 06:10:11 2016 > > New Revision: 270838 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=270838&view=rev > > Log: > > [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing > > OpenMP version. > > > > If '-fopenmp' option is provided '-fopenmp-version=' allows to control, > > which version of OpenMP must be supported. Currently it affects only the > > value of _OPENMP define. > > > > Modified: > > cfe/trunk/include/clang/Basic/LangOptions.def > > cfe/trunk/include/clang/Driver/Options.td > > cfe/trunk/lib/Driver/Tools.cpp > > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > > cfe/trunk/lib/Frontend/InitPreprocessor.cpp > > cfe/trunk/test/OpenMP/driver.c > > cfe/trunk/test/OpenMP/predefined_macro.c > > > > Modified: cfe/trunk/include/clang/Basic/LangOptions.def > > URL: http://llvm.org/viewvc/llvm- > > > project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838&r1=270 > > 837&r2=270838&view=diff > > > == > > > > --- cfe/trunk/include/clang/Basic/LangOptions.def (original) > > +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11 > > 2016 > > @@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ > > LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns") > > LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns") > > LANGOPT(CUDA , 1, 0, "CUDA") > > -LANGOPT(OpenMP, 1, 0, "OpenMP support") > > +LANGOPT(OpenMP, 32, 0, "OpenMP support and version of > OpenMP > > (31, 40 or 45)") > > LANGOPT(OpenMPUseTLS , 1, 0, "Use TLS for threadprivates or runtime > > calls") > > LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP > target > > device") > > > > > > Modified: cfe/trunk/include/clang/Driver/Options.td > > URL: http://llvm.org/viewvc/llvm- > > > project/cfe/trunk/include/clang/Driver/Options.td?rev=270838&r1=270837& > > r2=270838&view=diff > > > == > > > > --- cfe/trunk/include/clang/Driver/Options.td (original) > > +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016 > > @@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl > > def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, > > Group; > > def fopenmp : Flag<["-"], "fopenmp">, Group, > Flags<[CC1Option, > > NoArgumentUnused]>; > > def fno_openmp : Flag<["-"], "fno-openmp">, Group, > > Flags<[NoArgumentUnused]>; > > +def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, > > Group, Flags<[CC1Option, NoArgumentUnused]>; > > def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group; > > def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group, > > Flags<[NoArgumentUnused]>; > > def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, > > Group, Flags<[CC1Option, NoArgumentUnused]>; > > > > Modified: cfe/trunk/lib/Driver/Tools.cpp > > URL: http://llvm.org/viewvc/llvm- > > > project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838&r1=270837&r2=270838& > > view=diff > > > == > > > > --- cfe/trunk/lib/Driver/Tools.cpp (original) > > +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016 > > @@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation &C, > > > >// Forward flags for OpenMP > >if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, > > - options::OPT_fno_openmp, false)) > > + options::OPT_fno_openmp, false)) { > > +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ); > > switch (getOpenMPRuntime(getToolChain(), Args)) { > > case OMPRT_OMP: > > case OMPRT_IOMP5: > > @@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation &C, > >// semantic analysis, etc. > >break; > > } > > + } > > > >const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs(); > >Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType); > > > > Modified: cfe/trunk/lib/Frontend/CompilerIn
r270974 - [MSVC2015] Fix mangling for static variables initialization guards
Author: dpolukhin Date: Fri May 27 03:52:34 2016 New Revision: 270974 URL: http://llvm.org/viewvc/llvm-project?rev=270974&view=rev Log: [MSVC2015] Fix mangling for static variables initialization guards It seems that suffix '@4HA' was omitted for unknown reason. It is non-cont non-volatile 'int' type of normal variable TSS. Differential revision: http://reviews.llvm.org/D20683 Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=270974&r1=270973&r2=270974&view=diff == --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri May 27 03:52:34 2016 @@ -2837,6 +2837,7 @@ void MicrosoftMangleContextImpl::mangleT Mangler.getStream() << "\01?$TSS" << GuardNum << '@'; Mangler.mangleNestedName(VD); + Mangler.getStream() << "@4HA"; } void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD, Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp?rev=270974&r1=270973&r2=270974&view=diff == --- cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp (original) +++ cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp Fri May 27 03:52:34 2016 @@ -9,12 +9,14 @@ struct S { // CHECK-DAG: @"\01?s@?1??f@@YAAAUS@@XZ@4U2@A" = linkonce_odr thread_local global %struct.S zeroinitializer // CHECK-DAG: @"\01??__J?1??f@@YAAAUS@@XZ@51" = linkonce_odr thread_local global i32 0 // CHECK-DAG: @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A" = linkonce_odr global %struct.S zeroinitializer -// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" = linkonce_odr global i32 0 // CHECK-DAG: @_Init_thread_epoch = external thread_local global i32, align 4 // CHECK-DAG: @"\01?j@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr thread_local global %struct.S zeroinitializer // CHECK-DAG: @"\01??__J?1??h@@YAAAUS@@_N@Z@51" = linkonce_odr thread_local global i32 0 // CHECK-DAG: @"\01?i@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr global %struct.S zeroinitializer -// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z@4HA" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?i@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4 +// CHECK-DAG: @"\01?$TSS0@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4 // CHECK-LABEL: define {{.*}} @"\01?f@@YAAAUS@@XZ"() // CHECK-SAME: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) @@ -51,14 +53,14 @@ extern inline S &f() { // CHECK-LABEL: define {{.*}} @"\01?g@@YAAAUS@@XZ"() extern inline S &g() { static S s; -// CHECK: %[[guard:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4 +// CHECK: %[[guard:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4 // CHECK-NEXT: %[[epoch:.*]] = load i32, i32* @_Init_thread_epoch // CHECK-NEXT: %[[cmp:.*]] = icmp sgt i32 %[[guard]], %[[epoch]] // CHECK-NEXT: br i1 %[[cmp]], label %[[init_attempt:.*]], label %[[init_end:.*]] // // CHECK: [[init_attempt]]: -// CHECK-NEXT: call void @_Init_thread_header(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") -// CHECK-NEXT: %[[guard2:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4 +// CHECK-NEXT: call void @_Init_thread_header(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") +// CHECK-NEXT: %[[guard2:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4 // CHECK-NEXT: %[[cmp2:.*]] = icmp eq i32 %[[guard2]], -1 // CHECK-NEXT: br i1 %[[cmp2]], label %[[init:.*]], label %[[init_end:.*]] // @@ -68,7 +70,7 @@ extern inline S &g() { // // CHECK: [[invoke_cont]]: // CHECK-NEXT: call i32 @atexit(void ()* @"\01??__Fs@?1??g@@YAAAUS@@XZ@YAXXZ") -// CHECK-NEXT: call void @_Init_thread_footer(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") +// CHECK-NEXT: call void @_Init_thread_footer(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") // CHECK-NEXT: br label %init.end // // CHECK: [[init_end]]: @@ -76,7 +78,7 @@ extern inline S &g() { // // CHECK: [[lpad]]: // CHECK-NEXT: cleanuppad within none [] -// CHECK: call void @_Init_thread_abort(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") +// CHECK: call void @_Init_thread_abort(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") // CHECK-NEXT: cleanupret {{.*}} unwind to caller return s; } @@ -86,3 +88,10 @@ extern inline S&h(bool b) { static S i; return b ? j : i; } + +// CHECK-LABEL: define i32 @"\01?g1@@YAHXZ"() +int f1(); +int g1() { + static int i = f1(); +
Re: [PATCH] D20683: [MSVC2015] Fix mangling for static variables initialization guards
This revision was automatically updated to reflect the committed changes. Closed by commit rL270974: [MSVC2015] Fix mangling for static variables initialization guards (authored by dpolukhin). Changed prior to commit: http://reviews.llvm.org/D20683?vs=58611&id=58759#toc Repository: rL LLVM http://reviews.llvm.org/D20683 Files: cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp Index: cfe/trunk/lib/AST/MicrosoftMangle.cpp === --- cfe/trunk/lib/AST/MicrosoftMangle.cpp +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp @@ -2837,6 +2837,7 @@ Mangler.getStream() << "\01?$TSS" << GuardNum << '@'; Mangler.mangleNestedName(VD); + Mangler.getStream() << "@4HA"; } void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD, Index: cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp === --- cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp +++ cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp @@ -9,12 +9,14 @@ // CHECK-DAG: @"\01?s@?1??f@@YAAAUS@@XZ@4U2@A" = linkonce_odr thread_local global %struct.S zeroinitializer // CHECK-DAG: @"\01??__J?1??f@@YAAAUS@@XZ@51" = linkonce_odr thread_local global i32 0 // CHECK-DAG: @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A" = linkonce_odr global %struct.S zeroinitializer -// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" = linkonce_odr global i32 0 // CHECK-DAG: @_Init_thread_epoch = external thread_local global i32, align 4 // CHECK-DAG: @"\01?j@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr thread_local global %struct.S zeroinitializer // CHECK-DAG: @"\01??__J?1??h@@YAAAUS@@_N@Z@51" = linkonce_odr thread_local global i32 0 // CHECK-DAG: @"\01?i@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr global %struct.S zeroinitializer -// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z@4HA" = linkonce_odr global i32 0 +// CHECK-DAG: @"\01?i@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4 +// CHECK-DAG: @"\01?$TSS0@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4 // CHECK-LABEL: define {{.*}} @"\01?f@@YAAAUS@@XZ"() // CHECK-SAME: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) @@ -51,14 +53,14 @@ // CHECK-LABEL: define {{.*}} @"\01?g@@YAAAUS@@XZ"() extern inline S &g() { static S s; -// CHECK: %[[guard:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4 +// CHECK: %[[guard:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4 // CHECK-NEXT: %[[epoch:.*]] = load i32, i32* @_Init_thread_epoch // CHECK-NEXT: %[[cmp:.*]] = icmp sgt i32 %[[guard]], %[[epoch]] // CHECK-NEXT: br i1 %[[cmp]], label %[[init_attempt:.*]], label %[[init_end:.*]] // // CHECK: [[init_attempt]]: -// CHECK-NEXT: call void @_Init_thread_header(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") -// CHECK-NEXT: %[[guard2:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4 +// CHECK-NEXT: call void @_Init_thread_header(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") +// CHECK-NEXT: %[[guard2:.*]] = load atomic i32, i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4 // CHECK-NEXT: %[[cmp2:.*]] = icmp eq i32 %[[guard2]], -1 // CHECK-NEXT: br i1 %[[cmp2]], label %[[init:.*]], label %[[init_end:.*]] // @@ -68,15 +70,15 @@ // // CHECK: [[invoke_cont]]: // CHECK-NEXT: call i32 @atexit(void ()* @"\01??__Fs@?1??g@@YAAAUS@@XZ@YAXXZ") -// CHECK-NEXT: call void @_Init_thread_footer(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") +// CHECK-NEXT: call void @_Init_thread_footer(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") // CHECK-NEXT: br label %init.end // // CHECK: [[init_end]]: // CHECK-NEXT: ret %struct.S* @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A" // // CHECK: [[lpad]]: // CHECK-NEXT: cleanuppad within none [] -// CHECK: call void @_Init_thread_abort(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ") +// CHECK: call void @_Init_thread_abort(i32* @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA") // CHECK-NEXT: cleanupret {{.*}} unwind to caller return s; } @@ -86,3 +88,10 @@ static S i; return b ? j : i; } + +// CHECK-LABEL: define i32 @"\01?g1@@YAHXZ"() +int f1(); +int g1() { + static int i = f1(); + return i; +} Index: cfe/trunk/lib/AST/MicrosoftMangle.cpp === --- cfe/trunk/lib/AST/MicrosoftMangle.cpp +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp @@ -2837,6 +2837,7 @@ Mangler.getStream() << "\01?$TSS" << GuardNum << '@'; Mangler.mangleNestedName(VD); + Mangler.getStream() << "@4HA"; } void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD, Index: cfe/trunk/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp =
r270975 - clang-format: Allow splitting the line after /**/-comments.
Author: djasper Date: Fri May 27 03:59:34 2016 New Revision: 270975 URL: http://llvm.org/viewvc/llvm-project?rev=270975&view=rev Log: clang-format: Allow splitting the line after /**/-comments. While it might change the meaning of the comment in rare circumstances, it is better than violating the column limit. Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTest.cpp Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=270975&r1=270974&r2=270975&view=diff == --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri May 27 03:59:34 2016 @@ -1826,6 +1826,8 @@ unsigned TokenAnnotator::splitPenalty(co return 500; if (Left.isOneOf(tok::kw_class, tok::kw_struct)) return 5000; + if (Left.is(tok::comment)) +return 1000; if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon)) return 2; @@ -2464,7 +2466,7 @@ bool TokenAnnotator::canBreakBefore(cons Left.getPrecedence() == prec::Assignment)) return true; return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, - tok::kw_class, tok::kw_struct) || + tok::kw_class, tok::kw_struct, tok::comment) || Right.isMemberAccess() || Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless, tok::colon, tok::l_square, tok::at) || Modified: cfe/trunk/unittests/Format/FormatTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=270975&r1=270974&r2=270975&view=diff == --- cfe/trunk/unittests/Format/FormatTest.cpp (original) +++ cfe/trunk/unittests/Format/FormatTest.cpp Fri May 27 03:59:34 2016 @@ -1143,6 +1143,8 @@ TEST_F(FormatTest, UnderstandsBlockComme " aa ,\n" "aa) { /*aaa*/\n" "}")); + verifyFormat("f(/* aa = */\n" + " );"); FormatStyle NoBinPacking = getLLVMStyle(); NoBinPacking.BinPackParameters = false; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20561: Warn when taking address of packed member
rogfer01 added a comment. Forget my wrong comment about packed fields that might actually be aligned. It does not make sense. Regarding the way to selectively disable this, there is little syntax available at this point that we can leverage, so I propose to use parentheses as a way to disable the warning, e.g. `&a.b` may warn but `&(a.b)` will never warn. This may not be ideal but is in practice not that far from the classical `( (x = b) )` idiom used to silence the assignment-vs-equality warning. Closer examination of Firefox code shows that `memcpy`/`memcmp` are used with packed members in the networking code. Being able to disable those safe uses by means of parentheses seems sensible to me. I will upload a new patch with this change. http://reviews.llvm.org/D20561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20561: Warn when taking address of packed member
rogfer01 updated this revision to Diff 58760. rogfer01 added a comment. Only warn if the expression is of the form &a.x this way &(a.x) can be used to silence the warning. http://reviews.llvm.org/D20561 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Sema/address-packed.c test/SemaCXX/address-packed.cpp Index: test/SemaCXX/address-packed.cpp === --- /dev/null +++ test/SemaCXX/address-packed.cpp @@ -0,0 +1,186 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +extern void f1(int *); +extern void f2(char *); + +struct Ok { + char c; + int x; +}; + +struct __attribute__((packed)) Arguable { + char c; + int x; + static void foo(); +}; + +union __attribute__((packed)) UnionArguable { + char c; + int x; + static void foo(); +}; + +extern void f3(void()); + +typedef struct Arguable ArguableT; + +namespace Foo { +struct __attribute__((packed)) Arguable { + char c; + int x; + static void foo(); +}; +} + +struct Arguable* get_arguable(); + +void g0() { + { +struct Ok ok; +f1(&ok.x); // no-warning +f2(&ok.c); // no-warning + } + { +struct Arguable arguable; +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure 'Arguable'}} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure 'Arguable'}} + } + { +union UnionArguable arguable; +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure 'UnionArguable'}} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure 'UnionArguable'}} + } + { +ArguableT arguable; +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure }} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure }} + } + { +struct Arguable *arguable = get_arguable(); +f1(&(arguable->x)); // no-warning +f2(&(arguable->c)); // no-warning + } + { +ArguableT *arguable = get_arguable(); +f1(&(arguable->x)); // no-warning +f2(&(arguable->c)); // no-warning + } + + { +Ok ok; +f1(&ok.x); // no-warning +f2(&ok.c); // no-warning + } + { +Arguable arguable; +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure 'Arguable'}} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure 'Arguable'}} +f3(&arguable.foo); // no-warning + } + { +Foo::Arguable arguable; +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure 'Foo::Arguable'}} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure 'Foo::Arguable'}} +f3(&arguable.foo); // no-warning + } + { +Arguable arguable1; +Arguable &arguable(arguable1); +f1(&arguable.x); // expected-warning {{packed member 'x' of class or structure 'Arguable'}} +f2(&arguable.c); // expected-warning {{packed member 'c' of class or structure 'Arguable'}} +f3(&arguable.foo); // no-warning + } + { +Arguable *arguable1; +Arguable *&arguable(arguable1); +f1(&arguable->x); // expected-warning {{packed member 'x' of class or structure 'Arguable'}} +f2(&arguable->c); // expected-warning {{packed member 'c' of class or structure 'Arguable'}} +f3(&arguable->foo); // no-warning + } +} + +struct S1 { + char c; + int i __attribute__((packed)); +}; + +int *g1(struct S1 *s1) { + return &s1->i; // expected-warning {{packed member 'i' of class or structure 'S1'}} +} + +struct S2_i { + int i; +}; +struct __attribute__((packed)) S2 { + char c; + struct S2_i inner; +}; + +int *g2(struct S2 *s2) { + return &s2->inner.i; // expected-warning {{packed member 'inner' of class or structure 'S2'}} +} + +struct S2_a { + char c; + struct S2_i inner __attribute__((packed)); +}; + +int *g2_a(struct S2_a *s2_a) { + return &s2_a->inner.i; // expected-warning {{packed member 'inner' of class or structure 'S2_a'}} +} + +struct __attribute__((packed)) S3 { + char c; + struct { +int i; + } inner; +}; + +int *g3(struct S3 *s3) { + return &s3->inner.i; // expected-warning {{packed member 'inner' of class or structure 'S3'}} +} + +struct S4 { + char c; + struct __attribute__((packed)) { +int i; + } inner; +}; + +int *g4(struct S4 *s4) { + return &s4->inner.i; // expected-warning {{packed member 'i' of class or structure 'S4::(anonymous)'}} +} + +struct S5 { + char c; + struct { +char c1; +int i __attribute__((packed)); + } inner; +}; + +int *g5(struct S5 *s5) { + return &s5->inner.i; // expected-warning {{packed member 'i' of class or structure 'S5::(anonymous)'}} +} + +struct __attribute__((packed)) A { + char c; + int x; + + int *f0() { +return &this->x; // expected-warning {{packed member 'x' of class or structure 'A'}} + } + + int *g0() { +return &x; // expected-warning {{packed member 'x' of class or structure 'A'}} + } +}; + +struct B : A {
Re: [PATCH] D20614: Remove trailing spaces in x86 intrinsic headers
m_zuckerman accepted this revision. m_zuckerman added a comment. This revision is now accepted and ready to land. LGTM Repository: rL LLVM http://reviews.llvm.org/D20614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270983 - Convert assert to static_assert. NFC.
Author: d0k Date: Fri May 27 06:48:53 2016 New Revision: 270983 URL: http://llvm.org/viewvc/llvm-project?rev=270983&view=rev Log: Convert assert to static_assert. NFC. Modified: cfe/trunk/include/clang/AST/Type.h Modified: cfe/trunk/include/clang/AST/Type.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=270983&r1=270982&r2=270983&view=diff == --- cfe/trunk/include/clang/AST/Type.h (original) +++ cfe/trunk/include/clang/AST/Type.h Fri May 27 06:48:53 2016 @@ -5357,7 +5357,8 @@ inline void QualType::removeLocalVolatil inline void QualType::removeLocalCVRQualifiers(unsigned Mask) { assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits"); - assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask); + static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask, +"Fast bits differ from CVR bits!"); // Fast path: we don't need to touch the slow qualifiers. removeLocalFastQualifiers(Mask); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270984 - [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC
Author: dsanders Date: Fri May 27 06:51:02 2016 New Revision: 270984 URL: http://llvm.org/viewvc/llvm-project?rev=270984&view=rev Log: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC Summary: This unifies mips/mipsel and mips64/mips64el into a single class so that we can later support O32 on mips64/mips64el and N32/N64 on mips/mipsel (when an appropriate CPU selected). Reviewers: atanasyan Subscribers: atanasyan, jfb, cfe-commits, dschuff Differential Revision: http://reviews.llvm.org/D20678 Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270984&r1=270983&r2=270984&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 06:51:02 2016 @@ -7006,8 +7006,29 @@ public: } }; -class MipsTargetInfoBase : public TargetInfo { - virtual void setDataLayout() = 0; +class MipsTargetInfo : public TargetInfo { + void setDataLayout() { +if (BigEndian) { + if (ABI == "o32" || ABI == "eabi") +resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); + else if (ABI == "n32") +resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else if (ABI == "n64") +resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else +llvm_unreachable("Invalid ABI"); +} else { + if (ABI == "o32" || ABI == "eabi") +resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); + else if (ABI == "n32") +resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else if (ABI == "n64") +resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else +llvm_unreachable("Invalid ABI"); +} + } + static const Builtin::Info BuiltinInfo[]; std::string CPU; @@ -7028,12 +7049,39 @@ protected: std::string ABI; public: - MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &, - const std::string &ABIStr, const std::string &CPUStr) - : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false), -IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat), -DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) { + MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &) + : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "mips32r2" +: "mips64r2"), +IsMips16(false), IsMicromips(false), IsNan2008(false), +IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false), +HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "o32" +: "n64") { TheCXXABI.set(TargetCXXABI::GenericMIPS); +BigEndian = getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mips64; + +if (getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mipsel) { + SizeType = UnsignedInt; + PtrDiffType = SignedInt; + Int64Type = SignedLongLong; + IntMaxType = Int64Type; + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; +} else { + LongDoubleWidth = LongDoubleAlign = 128; + LongDoubleFormat = &llvm::APFloat::IEEEquad; + if (getTriple().getOS() == llvm::Triple::FreeBSD) { +LongDoubleWidth = LongDoubleAlign = 64; +LongDoubleFormat = &llvm::APFloat::IEEEdouble; + } + setN64ABITypes(); + SuitableAlign = 128; + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; +} } bool isNaN2008Default() const { @@ -7049,6 +7097,48 @@ public: } StringRef getABI() const override { return ABI; } + bool setABI(const std::string &Name) override { +if (getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mipsel) { + if (Name == "o32" || Name == "eabi") { +ABI = Name; +return true; + } +} +if (getTriple().getArch() == llvm::Triple::mips64 || +getTriple().getArch() == llvm::Triple::mips64el) { + if (Name == "n32") { +setN32ABITypes(); +ABI = Name; +return true; + } + if (Name == "n64") { +setN64ABITypes(); +ABI = Name; +return true; + } +} +return false; + } + + void setN64ABITypes() { +LongWidth = LongAlign = 64; +PointerWidth = PointerAlign = 64; +SizeType = UnsignedLong; +PtrDiffType = SignedLong; +In
Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC
This revision was automatically updated to reflect the committed changes. Closed by commit rL270984: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename… (authored by dsanders). Changed prior to commit: http://reviews.llvm.org/D20678?vs=58604&id=58770#toc Repository: rL LLVM http://reviews.llvm.org/D20678 Files: cfe/trunk/lib/Basic/Targets.cpp Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -7006,8 +7006,29 @@ } }; -class MipsTargetInfoBase : public TargetInfo { - virtual void setDataLayout() = 0; +class MipsTargetInfo : public TargetInfo { + void setDataLayout() { +if (BigEndian) { + if (ABI == "o32" || ABI == "eabi") +resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); + else if (ABI == "n32") +resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else if (ABI == "n64") +resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else +llvm_unreachable("Invalid ABI"); +} else { + if (ABI == "o32" || ABI == "eabi") +resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); + else if (ABI == "n32") +resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else if (ABI == "n64") +resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); + else +llvm_unreachable("Invalid ABI"); +} + } + static const Builtin::Info BuiltinInfo[]; std::string CPU; @@ -7028,12 +7049,39 @@ std::string ABI; public: - MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &, - const std::string &ABIStr, const std::string &CPUStr) - : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false), -IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat), -DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) { + MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &) + : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "mips32r2" +: "mips64r2"), +IsMips16(false), IsMicromips(false), IsNan2008(false), +IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false), +HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "o32" +: "n64") { TheCXXABI.set(TargetCXXABI::GenericMIPS); +BigEndian = getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mips64; + +if (getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mipsel) { + SizeType = UnsignedInt; + PtrDiffType = SignedInt; + Int64Type = SignedLongLong; + IntMaxType = Int64Type; + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; +} else { + LongDoubleWidth = LongDoubleAlign = 128; + LongDoubleFormat = &llvm::APFloat::IEEEquad; + if (getTriple().getOS() == llvm::Triple::FreeBSD) { +LongDoubleWidth = LongDoubleAlign = 64; +LongDoubleFormat = &llvm::APFloat::IEEEdouble; + } + setN64ABITypes(); + SuitableAlign = 128; + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; +} } bool isNaN2008Default() const { @@ -7049,6 +7097,48 @@ } StringRef getABI() const override { return ABI; } + bool setABI(const std::string &Name) override { +if (getTriple().getArch() == llvm::Triple::mips || +getTriple().getArch() == llvm::Triple::mipsel) { + if (Name == "o32" || Name == "eabi") { +ABI = Name; +return true; + } +} +if (getTriple().getArch() == llvm::Triple::mips64 || +getTriple().getArch() == llvm::Triple::mips64el) { + if (Name == "n32") { +setN32ABITypes(); +ABI = Name; +return true; + } + if (Name == "n64") { +setN64ABITypes(); +ABI = Name; +return true; + } +} +return false; + } + + void setN64ABITypes() { +LongWidth = LongAlign = 64; +PointerWidth = PointerAlign = 64; +SizeType = UnsignedLong; +PtrDiffType = SignedLong; +Int64Type = SignedLong; +IntMaxType = Int64Type; + } + + void setN32ABITypes() { +LongWidth = LongAlign = 32; +PointerWidth = PointerAlign = 32; +SizeType = UnsignedInt; +PtrDiffType = SignedInt; +Int64Type = SignedLongLong; +IntMaxType = Int64Type; + } + bool setCPU(const std::string &Name) override { bool IsMips32 = getTriple().getArch() == llvm::Triple::mips ||
r270985 - Update for following LLVM commit.
Author: grimar Date: Fri May 27 07:15:25 2016 New Revision: 270985 URL: http://llvm.org/viewvc/llvm-project?rev=270985&view=rev Log: Update for following LLVM commit. It will be: Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections. Modified: cfe/trunk/tools/driver/cc1as_main.cpp Modified: cfe/trunk/tools/driver/cc1as_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=270985&r1=270984&r2=270985&view=diff == --- cfe/trunk/tools/driver/cc1as_main.cpp (original) +++ cfe/trunk/tools/driver/cc1as_main.cpp Fri May 27 07:15:25 2016 @@ -313,7 +313,7 @@ static bool ExecuteAssembler(AssemblerIn // Ensure MCAsmInfo initialization occurs before any use, otherwise sections // may be created with a combination of default and explicit settings. if (Opts.CompressDebugSections) -MAI->setCompressDebugSections(true); +MAI->setCompressDebugSections(DebugCompressionType::DCT_ZlibGnu); bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj; std::unique_ptr FDOS = getOutputStream(Opts, Diags, IsBinary); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.
dsanders updated this revision to Diff 58772. dsanders added a comment. Herald added subscribers: sdardis, emaste. Removed the 'eabi' from Tools.cpp this revealed three driver tests for passing -mabi to the assembler but the ABI itself is still completely untested. http://reviews.llvm.org/D20679 Files: lib/Basic/Targets.cpp lib/Driver/Tools.cpp test/Driver/freebsd-mips-as.c test/Driver/mips-abi.c test/Driver/mips-as.c Index: test/Driver/mips-as.c === --- test/Driver/mips-as.c +++ test/Driver/mips-as.c @@ -30,11 +30,6 @@ // RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EL" // -// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-EABI %s -// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB" -// // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s Index: test/Driver/mips-abi.c === --- test/Driver/mips-abi.c +++ test/Driver/mips-abi.c @@ -45,12 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS-ABI-O64 %s // MIPS-ABI-O64: error: unknown target ABI 'o64' // -// RUN: %clang -target mips-linux-gnu -### -c %s \ -// RUN:-mabi=eabi 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-ABI-EABI %s -// MIPS-ABI-EABI: "-target-cpu" "mips32r2" -// MIPS-ABI-EABI: "-target-abi" "eabi" -// // RUN: not %clang -target mips-linux-gnu -c %s \ // RUN:-mabi=unknown 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s Index: test/Driver/freebsd-mips-as.c === --- test/Driver/freebsd-mips-as.c +++ test/Driver/freebsd-mips-as.c @@ -45,11 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" // -// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-EABI %s -// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB" -// // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -1233,7 +1233,7 @@ if (CPUName.empty()) { // Deduce CPU name from ABI name. CPUName = llvm::StringSwitch(ABIName) - .Cases("o32", "eabi", DefMips32CPU) + .Case("o32", DefMips32CPU) .Cases("n32", "n64", DefMips64CPU) .Default(""); } Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -7009,16 +7009,16 @@ class MipsTargetInfo : public TargetInfo { void setDataLayout() { if (BigEndian) { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else if (ABI == "n64") resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else llvm_unreachable("Invalid ABI"); } else { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); @@ -7100,7 +7100,7 @@ bool setABI(const std::string &Name) override { if (getTriple().getArch() == llvm::Triple::mips || getTriple().getArch() == llvm::Triple::mipsel) { - if (Name == "o32" || Name == "eabi") { + if (Name == "o32") { ABI = Name; return true; } @@ -7217,9 +7217,7 @@ Builder.defineMacro("__mips_o32"); Builder.defineMacro("_ABIO32", "1"); Builder.defineMacro("_MIPS_SIM", "_ABIO32"); -} else if (ABI == "eabi") - Builder.defineMacro("__mips_eabi"); -else if (ABI == "n32") { +} else if (ABI == "n32") { Builder.defineMacro("__mips_n32"); Builder.defineMacro("_ABIN32", "2"); Builder.defineMacro("_MIPS_SIM", "_ABIN32"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.
dsanders added a comment. Just to double-check: Do you still agree we should kill this now that the number of tests covering EABI-specific behaviour is non-zero? I think we should on the basis that we still have no backend tests and no buildbots. The only tests we have check that the driver passes -mabi=eabi to the assembler. http://reviews.llvm.org/D20679 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
bcraig added a comment. LGTM. You may want to wait on Marshall's approval though. Thanks for being patient with me, and thanks for the patch! http://reviews.llvm.org/D20334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.
atanasyan added a comment. In http://reviews.llvm.org/D20679#442121, @dsanders wrote: > Just to double-check: Do you still agree we should kill this now that the > number of tests covering EABI-specific behaviour is non-zero? > > I think we should on the basis that we still have no backend tests and no > buildbots. The only tests we have check that the driver passes -mabi=eabi to > the assembler. I agree. http://reviews.llvm.org/D20679 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r270989 - [include-fixer] Add a missing .h.
Author: d0k Date: Fri May 27 07:49:58 2016 New Revision: 270989 URL: http://llvm.org/viewvc/llvm-project?rev=270989&view=rev Log: [include-fixer] Add a missing .h. Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp?rev=270989&r1=270988&r2=270989&view=diff == --- clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp (original) +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp Fri May 27 07:49:58 2016 @@ -59,7 +59,7 @@ const HeaderMapCollector::HeaderMap *get {"include/rdseedintrin.h", ""}, {"include/rtmintrin.h", ""}, {"include/shaintrin.h", ""}, - {"include/smmintrin.h", ""}, + {"include/smmintrin.h", ""}, {"include/stdalign.h", ""}, {"include/stdarg.h", ""}, {"include/stdbool.h", ""}, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270991 - [Frontend] StringRefize and fix bad indentation.
Author: d0k Date: Fri May 27 07:52:19 2016 New Revision: 270991 URL: http://llvm.org/viewvc/llvm-project?rev=270991&view=rev Log: [Frontend] StringRefize and fix bad indentation. NFC intended. Modified: cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp Modified: cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp?rev=270991&r1=270990&r2=270991&view=diff == --- cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp (original) +++ cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp Fri May 27 07:52:19 2016 @@ -49,31 +49,31 @@ public: }; } -static void PrintHeaderInfo(raw_ostream *OutputFile, const char* Filename, +static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename, bool ShowDepth, unsigned CurrentIncludeDepth, bool MSStyle) { -// Write to a temporary string to avoid unnecessary flushing on errs(). -SmallString<512> Pathname(Filename); -if (!MSStyle) - Lexer::Stringify(Pathname); - -SmallString<256> Msg; -if (MSStyle) - Msg += "Note: including file:"; - -if (ShowDepth) { - // The main source file is at depth 1, so skip one dot. - for (unsigned i = 1; i != CurrentIncludeDepth; ++i) -Msg += MSStyle ? ' ' : '.'; + // Write to a temporary string to avoid unnecessary flushing on errs(). + SmallString<512> Pathname(Filename); + if (!MSStyle) +Lexer::Stringify(Pathname); + + SmallString<256> Msg; + if (MSStyle) +Msg += "Note: including file:"; + + if (ShowDepth) { +// The main source file is at depth 1, so skip one dot. +for (unsigned i = 1; i != CurrentIncludeDepth; ++i) + Msg += MSStyle ? ' ' : '.'; - if (!MSStyle) -Msg += ' '; -} -Msg += Pathname; -Msg += '\n'; +if (!MSStyle) + Msg += ' '; + } + Msg += Pathname; + Msg += '\n'; -OutputFile->write(Msg.data(), Msg.size()); -OutputFile->flush(); + *OutputFile << Msg; + OutputFile->flush(); } void clang::AttachHeaderIncludeGen(Preprocessor &PP, @@ -104,8 +104,8 @@ void clang::AttachHeaderIncludeGen(Prepr // generation of Make / Ninja file dependencies for implicit includes, such // as sanitizer blacklists. It's only important for cl.exe compatibility, // the GNU way to generate rules is -M / -MM / -MD / -MMD. - for (auto Header : DepOpts.ExtraDeps) -PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle); + for (const auto &Header : DepOpts.ExtraDeps) +PrintHeaderInfo(OutputFile, Header, ShowDepth, 2, MSStyle); PP.addPPCallbacks(llvm::make_unique( &PP, ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth, MSStyle)); @@ -132,7 +132,7 @@ void HeaderIncludesCallback::FileChanged // place where we drop back to a nesting depth of 1. if (CurrentIncludeDepth == 1 && !HasProcessedPredefines) { if (!DepOpts.ShowIncludesPretendHeader.empty()) { -PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader.c_str(), +PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader, ShowDepth, 2, MSStyle); } HasProcessedPredefines = true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20729: [mips] Compact branch policy setting
sdardis created this revision. sdardis added reviewers: dsanders, atanasyan. sdardis added a subscriber: cfe-commits. Herald added a reviewer: vkalintiris. Herald added a subscriber: sdardis. This patch adds the commandline option -mcompact-branches={never,optimal,always), which controls how LLVM generates compact branches for MIPSR6 targets. By default, the compact branch policy is 'optimal' where LLVM will generate the most appropriate branch for any situation. The 'never' and 'always' policy will disable or always generate compact branches wherever possible respectfully. http://reviews.llvm.org/D20729 Files: docs/UsersManual.rst include/clang/Basic/DiagnosticDriverKinds.td include/clang/Basic/DiagnosticGroups.td include/clang/Driver/Options.td lib/Driver/Tools.cpp lib/Driver/Tools.h test/Driver/mips-features.c Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -116,6 +116,24 @@ // RUN: | FileCheck --check-prefix=CHECK-NANLEGACY %s // CHECK-NANLEGACY: "-target-feature" "-nan2008" // +// -mcompact-branches=never +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=never 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBNEVER %s +// CHECK-CBNEVER: "-mllvm" "-mips-compact-branches=never" +// +// -mcompact-branches=optimal +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=optimal 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBOPTIMAL %s +// CHECK-CBOPTIMAL: "-mllvm" "-mips-compact-branches=optimal" +// +// -mcompact-branches=always +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=always 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBALWAYS %s +// CHECK-CBALWAYS: "-mllvm" "-mips-compact-branches=always" +// // -mxgot // RUN: %clang -target mips-linux-gnu -### -c %s \ // RUN: -mno-xgot -mxgot 2>&1 \ Index: lib/Driver/Tools.h === --- lib/Driver/Tools.h +++ lib/Driver/Tools.h @@ -291,6 +291,7 @@ }; NanEncoding getSupportedNanEncoding(StringRef &CPU); +bool hasCompactBranches(StringRef &CPU); void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName, StringRef &ABIName); Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -1436,6 +1436,20 @@ CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v)); A->claim(); } + + if (Arg *A = Args.getLastArg(options::OPT_mcompact_branches_EQ)) { +StringRef Val = StringRef(A->getValue()); +if (mips::hasCompactBranches(CPUName)) { + if (Val == "never" || Val == "always" || Val == "optimal") { +CmdArgs.push_back("-mllvm"); +CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val)); + + } else +D.Diag(diag::err_drv_unsupported_option_argument) +<< A->getOption().getName() << Val; +} else + D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName; + } } /// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting. @@ -7065,6 +7079,15 @@ .Default(NanLegacy); } +bool mips::hasCompactBranches(StringRef &CPU) { + // mips32r6 and mips64r6 have compact branches. + + return (bool)llvm::StringSwitch(CPU) + .Case("mips32r6", true) + .Case("mips64r6", true) + .Default(false); +} + bool mips::hasMipsAbiArg(const ArgList &Args, const char *Value) { Arg *A = Args.getLastArg(options::OPT_mabi_EQ); return A && (A->getValue() == StringRef(Value)); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1621,6 +1621,7 @@ def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group; def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">, Group; +def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">, Group; def mdsp : Flag<["-"], "mdsp">, Group; def mno_dsp : Flag<["-"], "mno-dsp">, Group; def mdspr2 : Flag<["-"], "mdspr2">, Group; Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -56,6 +56,7 @@ def DoublePromotion : DiagGroup<"double-promotion">; def EnumTooLarge : DiagGroup<"enum-too-large">; def UnsupportedNan : DiagGroup<"unsupported-nan">; +def UnsupportedCB : DiagGroup<"unsupported-cb">; def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">; def NullConversion : DiagGroup<"null-conversion">; def Implic
Re: [PATCH] D20729: [mips] Compact branch policy setting
atanasyan accepted this revision. atanasyan added a comment. This revision is now accepted and ready to land. LGTM with some nits Comment at: lib/Driver/Tools.cpp:1446 @@ +1445,3 @@ +CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val)); + + } else Redundant empty line. Comment at: lib/Driver/Tools.cpp:7084 @@ +7083,3 @@ + // mips32r6 and mips64r6 have compact branches. + + return (bool)llvm::StringSwitch(CPU) Redundant empty line. Comment at: lib/Driver/Tools.cpp:7085 @@ +7084,3 @@ + + return (bool)llvm::StringSwitch(CPU) + .Case("mips32r6", true) Is it possible to re-write this line as: ``` return llvm::StringSwitch(CPU) ``` http://reviews.llvm.org/D20729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270994 - Turn copies into references as suggested by clang-tidy's performance-unnecessary-copy-initialization.
Author: d0k Date: Fri May 27 08:36:58 2016 New Revision: 270994 URL: http://llvm.org/viewvc/llvm-project?rev=270994&view=rev Log: Turn copies into references as suggested by clang-tidy's performance-unnecessary-copy-initialization. Modified: cfe/trunk/lib/Analysis/CFG.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/DependencyFile.cpp cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Modified: cfe/trunk/lib/Analysis/CFG.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/lib/Analysis/CFG.cpp (original) +++ cfe/trunk/lib/Analysis/CFG.cpp Fri May 27 08:36:58 2016 @@ -825,7 +825,7 @@ private: // * Variable x is equal to the largest literal. // * Variable x is greater than largest literal. bool AlwaysTrue = true, AlwaysFalse = true; -for (llvm::APSInt Value : Values) { +for (const llvm::APSInt &Value : Values) { TryResult Res1, Res2; Res1 = analyzeLogicOperatorCondition(BO1, Value, L1); Res2 = analyzeLogicOperatorCondition(BO2, Value, L2); Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 08:36:58 2016 @@ -6541,7 +6541,7 @@ void gcc::Common::ConstructJob(Compilati } } - const std::string customGCCName = D.getCCCGenericGCCName(); + const std::string &customGCCName = D.getCCCGenericGCCName(); const char *GCCName; if (!customGCCName.empty()) GCCName = customGCCName.c_str(); Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 27 08:36:58 2016 @@ -2416,7 +2416,7 @@ std::string CompilerInvocation::getModul // Extend the signature with the module file extensions. const FrontendOptions &frontendOpts = getFrontendOpts(); - for (auto ext : frontendOpts.ModuleFileExtensions) { + for (const auto &ext : frontendOpts.ModuleFileExtensions) { code = ext->hashExtension(code); } Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/lib/Frontend/DependencyFile.cpp (original) +++ cfe/trunk/lib/Frontend/DependencyFile.cpp Fri May 27 08:36:58 2016 @@ -177,7 +177,7 @@ public: SeenMissingHeader(false), IncludeModuleFiles(Opts.IncludeModuleFiles), OutputFormat(Opts.OutputFormat) { -for (auto ExtraDep : Opts.ExtraDeps) { +for (const auto &ExtraDep : Opts.ExtraDeps) { AddFilename(ExtraDep); } } Modified: cfe/trunk/lib/Sema/SemaLookup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) +++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri May 27 08:36:58 2016 @@ -4060,8 +4060,8 @@ retry_lookup: void TypoCorrectionConsumer::performQualifiedLookups() { unsigned TypoLen = Typo->getName().size(); - for (auto QR : QualifiedResults) { -for (auto NSI : Namespaces) { + for (const TypoCorrection &QR : QualifiedResults) { +for (const auto &NSI : Namespaces) { DeclContext *Ctx = NSI.DeclCtx; const Type *NSType = NSI.NameSpecifier->getAsType(); Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=270994&r1=270993&r2=270994&view=diff == --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original) +++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri May 27 08:36:58 2016 @@ -1449,9 +1449,9 @@ CreateSemanticSpellings(const std::vecto unsigned Idx = 0; for (auto I = Spellings.begin(), E = Spellings.end(); I != E; ++I, ++Idx) { const FlattenedSpelling &S = *I; -std::string Variety = S.variety(); -std::string Spelling = S.name(); -std::string Namespace = S.nameSpace(); +const std::string &Variety = S.variety(); +const std::string &Spelling = S.name(); +const std::string &Namespace = S.nameSpace(); std::string EnumName; En
Re: [PATCH] D20689: [clang-tidy] Suspicious Call Argument checker
alexfh added a comment. Thank you for the new check! Before starting with the review, I'd like to clarify one important thing. It's not immediately obvious that the pattern the check detects is actually a good indicator of a programming mistake. Did you try to run the check on a large enough codebase (at least, on the whole LLVM project) and analyze the results? http://clang.llvm.org/extra/clang-tidy/#running-clang-tidy-on-llvm describes the recommended way to run clang-tidy on LLVM. http://reviews.llvm.org/D20689 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20666: Fix a wrong check in misc-unused-using-decls
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. LG http://reviews.llvm.org/D20666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20010: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. LG http://reviews.llvm.org/D20010 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps
m_zuckerman added inline comments. Comment at: test/CodeGen/avx512f-builtins.c:1927 @@ +1926,3 @@ + // check-label: @test_mm512_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_div_pd(__a,__b); craig.topper wrote: > delena wrote: > > I don't understand how do you receive intrinsic if you issue IR. > The word "check" being in lowercase causes filecheck to ignore it so it isn't > being checked. You are right. Thanks I didn't saw it. I will fix it. http://reviews.llvm.org/D20626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270996 - Apply clang-tidy's misc-move-constructor-init throughout Clang.
Author: d0k Date: Fri May 27 09:27:13 2016 New Revision: 270996 URL: http://llvm.org/viewvc/llvm-project?rev=270996&view=rev Log: Apply clang-tidy's misc-move-constructor-init throughout Clang. No functionality change intended, maybe a tiny performance improvement. Modified: cfe/trunk/include/clang/AST/DeclTemplate.h cfe/trunk/include/clang/Basic/VirtualFileSystem.h cfe/trunk/include/clang/Frontend/Utils.h cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h cfe/trunk/lib/ARCMigrate/ARCMT.cpp cfe/trunk/lib/Basic/VirtualFileSystem.cpp cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Frontend/CompilerInstance.cpp cfe/trunk/lib/Frontend/PCHContainerOperations.cpp cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp cfe/trunk/lib/Lex/HeaderSearch.cpp cfe/trunk/lib/Lex/Preprocessor.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp cfe/trunk/lib/Tooling/Tooling.cpp cfe/trunk/tools/libclang/CIndexer.h cfe/trunk/tools/libclang/Indexing.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp cfe/trunk/utils/TableGen/NeonEmitter.cpp Modified: cfe/trunk/include/clang/AST/DeclTemplate.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=270996&r1=270995&r2=270996&view=diff == --- cfe/trunk/include/clang/AST/DeclTemplate.h (original) +++ cfe/trunk/include/clang/AST/DeclTemplate.h Fri May 27 09:27:13 2016 @@ -22,6 +22,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/TrailingObjects.h" #include +#include namespace clang { @@ -2332,9 +2333,9 @@ class ClassScopeFunctionSpecializationDe ClassScopeFunctionSpecializationDecl(DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD, bool Args, TemplateArgumentListInfo TemplArgs) -: Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc), - Specialization(FD), HasExplicitTemplateArgs(Args), - TemplateArgs(TemplArgs) {} + : Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc), +Specialization(FD), HasExplicitTemplateArgs(Args), +TemplateArgs(std::move(TemplArgs)) {} ClassScopeFunctionSpecializationDecl(EmptyShell Empty) : Decl(Decl::ClassScopeFunctionSpecialization, Empty) {} Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=270996&r1=270995&r2=270996&view=diff == --- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original) +++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Fri May 27 09:27:13 2016 @@ -20,6 +20,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" +#include namespace llvm { class MemoryBuffer; @@ -116,7 +117,8 @@ class directory_iterator { std::shared_ptr Impl; // Input iterator semantics on copy public: - directory_iterator(std::shared_ptr I) : Impl(I) { + directory_iterator(std::shared_ptr I) + : Impl(std::move(I)) { assert(Impl.get() != nullptr && "requires non-null implementation"); if (!Impl->CurrentEntry.isStatusKnown()) Impl.reset(); // Normalize the end iterator to Impl == nullptr. Modified: cfe/trunk/include/clang/Frontend/Utils.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=270996&r1=270995&r2=270996&view=diff == --- cfe/trunk/include/clang/Frontend/Utils.h (original) +++ cfe/trunk/include/clang/Frontend/Utils.h Fri May 27 09:27:13 2016 @@ -20,6 +20,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/Option/OptSpecifier.h" +#include namespace llvm { class raw_fd_ostream; @@ -141,7 +142,8 @@ public: void writeFileMap(); bool hasErrors() { return HasErrors; } - ModuleDependencyCollector(std::string DestDir) : DestDir(DestDir) {} + ModuleDependencyCollector(std::string DestDir) +
r270998 - [mips] Kill 'support' for untested EABI.
Author: dsanders Date: Fri May 27 09:30:23 2016 New Revision: 270998 URL: http://llvm.org/viewvc/llvm-project?rev=270998&view=rev Log: [mips] Kill 'support' for untested EABI. Summary: There are no llvm backend tests* for EABI and no EABI buildbots. There were only three clang tests, all of which checked that -mabi=eabi was passed to the assembler. *There is a single backend test that specifies EABI but it actually tests MIPS16. Reviewers: atanasyan Subscribers: emaste, sdardis, atanasyan, cfe-commits Differential Revision: http://reviews.llvm.org/D20679 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/freebsd-mips-as.c cfe/trunk/test/Driver/mips-abi.c cfe/trunk/test/Driver/mips-as.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270998&r1=270997&r2=270998&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri May 27 09:30:23 2016 @@ -7009,7 +7009,7 @@ public: class MipsTargetInfo : public TargetInfo { void setDataLayout() { if (BigEndian) { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); @@ -7018,7 +7018,7 @@ class MipsTargetInfo : public TargetInfo else llvm_unreachable("Invalid ABI"); } else { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); @@ -7100,7 +7100,7 @@ public: bool setABI(const std::string &Name) override { if (getTriple().getArch() == llvm::Triple::mips || getTriple().getArch() == llvm::Triple::mipsel) { - if (Name == "o32" || Name == "eabi") { + if (Name == "o32") { ABI = Name; return true; } @@ -7217,9 +7217,7 @@ public: Builder.defineMacro("__mips_o32"); Builder.defineMacro("_ABIO32", "1"); Builder.defineMacro("_MIPS_SIM", "_ABIO32"); -} else if (ABI == "eabi") - Builder.defineMacro("__mips_eabi"); -else if (ABI == "n32") { +} else if (ABI == "n32") { Builder.defineMacro("__mips_n32"); Builder.defineMacro("_ABIN32", "2"); Builder.defineMacro("_MIPS_SIM", "_ABIN32"); Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270998&r1=270997&r2=270998&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 09:30:23 2016 @@ -1233,7 +1233,7 @@ void mips::getMipsCPUAndABI(const ArgLis if (CPUName.empty()) { // Deduce CPU name from ABI name. CPUName = llvm::StringSwitch(ABIName) - .Cases("o32", "eabi", DefMips32CPU) + .Case("o32", DefMips32CPU) .Cases("n32", "n64", DefMips64CPU) .Default(""); } Modified: cfe/trunk/test/Driver/freebsd-mips-as.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd-mips-as.c?rev=270998&r1=270997&r2=270998&view=diff == --- cfe/trunk/test/Driver/freebsd-mips-as.c (original) +++ cfe/trunk/test/Driver/freebsd-mips-as.c Fri May 27 09:30:23 2016 @@ -45,11 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" // -// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-EABI %s -// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB" -// // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s Modified: cfe/trunk/test/Driver/mips-abi.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-abi.c?rev=270998&r1=270997&r2=270998&view=diff == --- cfe/trunk/test/Driver/mips-abi.c (original) +++ cfe/trunk/test/Driver/mips-abi.c Fri May 27 09:30:23 2016 @@ -45,12 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS-ABI-O64 %s // MIPS-ABI-O64: error: unknown target ABI 'o64' // -// RUN: %clang -target mips-linux-gnu -### -c %s \ -// RUN:-mabi=eabi 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-ABI-EABI %s -// MIPS-ABI-EABI: "-target-cpu" "mips32r2" -// MIPS-ABI-EABI: "-target-abi" "eabi" -// // RUN: not %clang -target mips-linux-
Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.
This revision was automatically updated to reflect the committed changes. Closed by commit rL270998: [mips] Kill 'support' for untested EABI. (authored by dsanders). Changed prior to commit: http://reviews.llvm.org/D20679?vs=58772&id=58782#toc Repository: rL LLVM http://reviews.llvm.org/D20679 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/freebsd-mips-as.c cfe/trunk/test/Driver/mips-abi.c cfe/trunk/test/Driver/mips-as.c Index: cfe/trunk/test/Driver/freebsd-mips-as.c === --- cfe/trunk/test/Driver/freebsd-mips-as.c +++ cfe/trunk/test/Driver/freebsd-mips-as.c @@ -45,11 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" // -// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-EABI %s -// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-EB" -// // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s Index: cfe/trunk/test/Driver/mips-abi.c === --- cfe/trunk/test/Driver/mips-abi.c +++ cfe/trunk/test/Driver/mips-abi.c @@ -45,12 +45,6 @@ // RUN: | FileCheck -check-prefix=MIPS-ABI-O64 %s // MIPS-ABI-O64: error: unknown target ABI 'o64' // -// RUN: %clang -target mips-linux-gnu -### -c %s \ -// RUN:-mabi=eabi 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-ABI-EABI %s -// MIPS-ABI-EABI: "-target-cpu" "mips32r2" -// MIPS-ABI-EABI: "-target-abi" "eabi" -// // RUN: not %clang -target mips-linux-gnu -c %s \ // RUN:-mabi=unknown 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s Index: cfe/trunk/test/Driver/mips-as.c === --- cfe/trunk/test/Driver/mips-as.c +++ cfe/trunk/test/Driver/mips-as.c @@ -30,11 +30,6 @@ // RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EL" // -// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=MIPS-EABI %s -// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "eabi" "-mno-shared" "-call_nonpic" "-EB" -// // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -7009,16 +7009,16 @@ class MipsTargetInfo : public TargetInfo { void setDataLayout() { if (BigEndian) { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else if (ABI == "n64") resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); else llvm_unreachable("Invalid ABI"); } else { - if (ABI == "o32" || ABI == "eabi") + if (ABI == "o32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); else if (ABI == "n32") resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); @@ -7100,7 +7100,7 @@ bool setABI(const std::string &Name) override { if (getTriple().getArch() == llvm::Triple::mips || getTriple().getArch() == llvm::Triple::mipsel) { - if (Name == "o32" || Name == "eabi") { + if (Name == "o32") { ABI = Name; return true; } @@ -7217,9 +7217,7 @@ Builder.defineMacro("__mips_o32"); Builder.defineMacro("_ABIO32", "1"); Builder.defineMacro("_MIPS_SIM", "_ABIO32"); -} else if (ABI == "eabi") - Builder.defineMacro("__mips_eabi"); -else if (ABI == "n32") { +} else if (ABI == "n32") { Builder.defineMacro("__mips_n32"); Builder.defineMacro("_ABIN32", "2"); Builder.defineMacro("_MIPS_SIM", "_ABIN32"); Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -1233,7 +1233,7 @@ if (CPUName.empty()) { // Deduce CPU name from ABI name. CPUName = llvm::StringSwitch(ABIName) - .Cases("o32", "eabi", DefMips32CPU) + .Case("o32", DefMips32CPU) .Cases("n32", "n64", DefMips64CPU) .Default(""); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt
Re: [PATCH] D18110: [OpenMP] Fix SEMA bug in the capture of global variables in template functions.
sfantao added a comment. In http://reviews.llvm.org/D18110#441959, @ABataev wrote: > Hi Daniel, > Will fix it ASAP Hi Alexey, Just to make sure: the bug I am talking about is fixed by this patch, that's why I didn't abandon this patch, instead I just rebased it. Sorry if my comment was misleading. Thanks, Samuel http://reviews.llvm.org/D18110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20730: [libcxx] Prefer UNSUPPORTED over conditional compilation for tests
rmaprath created this revision. rmaprath added a reviewer: EricWF. rmaprath added a subscriber: cfe-commits. We seem to have quite a few tests where an entire test is conditionalized over some range of `_LIBCPP_STD_VER`. We should consider getting rid of these and using the UNSUPPORTED lit directive instead. This is mostly cosmetic, but sometimes can create problems if there are also XFAIL conditions on the same test. The test will be reported as an unexpected-pass when run with a `std=` option not compatible with the `_LIBCPP_STD_VER` check (because the test is trivially empty, it will pass rather than XFAIL). I've attached a sample patch for one of the cases. If this looks OK, I can commit the whole hog. http://reviews.llvm.org/D20730 Files: test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp Index: test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp === --- test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp +++ test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp @@ -7,6 +7,7 @@ // //===--===// +// UNSUPPORTED: c++98, c++03, c++11 // XFAIL: libcpp-no-exceptions // dynarray.overview @@ -15,8 +16,6 @@ #include <__config> -#if _LIBCPP_STD_VER > 11 - #include #include @@ -90,6 +89,3 @@ test> ( {} ); test ( {} ); } -#else -int main() {} -#endif Index: test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp === --- test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp +++ test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp @@ -7,6 +7,7 @@ // //===--===// +// UNSUPPORTED: c++98, c++03, c++11 // XFAIL: libcpp-no-exceptions // dynarray.overview @@ -15,8 +16,6 @@ #include <__config> -#if _LIBCPP_STD_VER > 11 - #include #include @@ -90,6 +89,3 @@ test> ( {} ); test ( {} ); } -#else -int main() {} -#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
aaron.ballman updated this revision to Diff 58784. aaron.ballman marked an inline comment as done. aaron.ballman added a comment. Updated based on review comments. http://reviews.llvm.org/D20428 Files: include/clang/AST/Decl.h include/clang/AST/TypeLoc.h lib/AST/Decl.cpp lib/Parse/ParseDeclCXX.cpp lib/Sema/SemaType.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp unittests/AST/SourceLocationTest.cpp Index: unittests/AST/SourceLocationTest.cpp === --- unittests/AST/SourceLocationTest.cpp +++ unittests/AST/SourceLocationTest.cpp @@ -580,5 +580,72 @@ Language::Lang_CXX11)); } +class ExceptionSpecRangeVerifier : public RangeVerifier { +protected: + SourceRange getRange(const TypeLoc &Node) override { +auto T = + Node.getUnqualifiedLoc().castAs(); +assert(!T.isNull()); +return T.getExceptionSpecRange(); + } +}; + +class ParmVarExceptionSpecRangeVerifier : public RangeVerifier { +protected: + SourceRange getRange(const ParmVarDecl &Node) override { +if (const TypeSourceInfo *TSI = Node.getTypeSourceInfo()) { + TypeLoc TL = TSI->getTypeLoc(); + if (TL.getType()->isPointerType()) { +TL = TL.getNextTypeLoc().IgnoreParens(); +if (auto FPTL = TL.getAs()) { + return FPTL.getExceptionSpecRange(); +} + } +} +return SourceRange(); + } +}; + +TEST(FunctionDecl, ExceptionSpecifications) { + ExceptionSpecRangeVerifier Verifier; + + Verifier.expectRange(1, 10, 1, 16); + EXPECT_TRUE(Verifier.match("void f() throw();\n", loc(functionType(; + + Verifier.expectRange(1, 10, 1, 34); + EXPECT_TRUE(Verifier.match("void f() throw(void(void) throw());\n", + loc(functionType(; + + Verifier.expectRange(1, 10, 1, 19); + std::vector Args; + Args.push_back("-fms-extensions"); + EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()), + Args, Language::Lang_CXX)); + + Verifier.expectRange(1, 10, 1, 17); + EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()), + Language::Lang_CXX11)); + + Verifier.expectRange(1, 10, 1, 24); + EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()), + Language::Lang_CXX11)); + + Verifier.expectRange(1, 10, 1, 32); + EXPECT_TRUE(Verifier.match("void f() noexcept(noexcept(1+1));\n", + loc(functionType()), Language::Lang_CXX11)); + + ParmVarExceptionSpecRangeVerifier Verifier2; + Verifier2.expectRange(1, 25, 1, 31); + EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) throw());\n", + parmVarDecl(hasType(pointerType(pointee( + parenType(innerType(functionType(); + + Verifier2.expectRange(1, 25, 1, 38); + EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) noexcept(true));\n", + parmVarDecl(hasType(pointerType(pointee( + parenType(innerType(functionType())), + Language::Lang_CXX11)); +} + } // end namespace ast_matchers } // end namespace clang Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -572,6 +572,7 @@ Record.AddSourceLocation(TL.getLocalRangeBegin()); Record.AddSourceLocation(TL.getLParenLoc()); Record.AddSourceLocation(TL.getRParenLoc()); + Record.AddSourceRange(TL.getExceptionSpecRange()); Record.AddSourceLocation(TL.getLocalRangeEnd()); for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) Record.AddDeclRef(TL.getParam(i)); Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -5812,6 +5812,8 @@ TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx)); TL.setLParenLoc(ReadSourceLocation(Record, Idx)); TL.setRParenLoc(ReadSourceLocation(Record, Idx)); + TL.setExceptionSpecRange(SourceRange(ReadSourceLocation(Record, Idx), + ReadSourceLocation(Record, Idx))); TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx)); for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) { TL.setParam(i, ReadDeclAs(Record, Idx)); Index: lib/Sema/TreeTransform.h === --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -4942,6 +4942,7 @@ NewTL.setLocalRangeBegin(TL.getLocalRangeBegin()); NewTL.setLParenLoc(TL.getLParenLoc()); NewTL.setRParenLoc(TL.getRParenLoc()); + NewTL.setExceptionSpecRange(TL.getExceptionSpecRange()); NewTL.setLocalRangeEnd(TL.getLocalRangeEnd()); for (unsigned i = 0, e = NewTL.g
Re: [PATCH] D20428: Tracking exception specification source locations
aaron.ballman added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3427 @@ -3402,5 +3402,6 @@ // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3423,6 +3424,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } rsmith wrote: > This change seems strange: > > 1) We should be using normal token-based ranges here; the > `getEndLoc().getLocWithOffset(-1)` doesn't make sense. > 2) This specifies a range for the error case, where we produce an exception > specification of `EST_None`. We should not have a `NoexceptRange` if we're > recovering as if there were no `noexcept`. > > Can you revert the changes to this file? I agree that this code is strange, what I found was that anything other than getLocWithOffset would produce the wrong range (the resulting range would be off-by-one). I found other code that does this, but it may be equally incorrect if there's a better way to get a range for a token. As for #2, I don't think that's actually the case. This is the code path that parses a noexcept specifier with no arguments. (Result starts as EST_None, we aren't delayed, there is no dynamic exception spec, the next token is noexcept, there is no l_paren, and so we set SpecificationRange and Result before returning). Without tracking the source range, the following test case fails because the token range has no length: ``` Verifier.expectRange(1, 10, 1, 17); EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()), Language::Lang_CXX11)); ``` Is there a better way for me to get the full source range of the token? I would have assumed that getEndLoc() would work, but it appears to give an inconsistent result with other ranges that we track. e.g., noexcept(false) the caret points at ), throw(...) the caret points at ), but without the -1 offset above for void f() noexcept; the caret points at ; instead of t. http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20447: [OpenCL] Fixup extension list
yaxunl added inline comments. Comment at: test/SemaOpenCL/extension-version.cl:11 @@ +10,3 @@ +#endif +#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable + Anastasia wrote: > jvesely wrote: > > Anastasia wrote: > > > jvesely wrote: > > > > Anastasia wrote: > > > > > Could you use standard diagnostic check please: > > > > > expected-warning{{unknown OpenCL extension ... > > > > > > > > > > Similarly to SemaOpenCL/extensions.cl > > > > not sure I follow, the test does not trigger any diagnostics (by > > > > design). > > > > are you saying that I should introduce negative checks to make sure > > > > extensions are not available outside of their respective context? > > > > Is there a way to filter verifier tags based on clang invocation? > > > > (something like FileCheck prefix) > > > Exactly, you should check that the extensions are enabled correctly based > > > on CL versions. > > > > > > For example if you compile this without passing -cl-std=CL1.2: > > > #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable > > > the following error is produced: > > > unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring > > > > > > You can condition error directives on CL version passed as it's done in > > > the example test SemaOpenCL/extensions.cl. > > > > > > So what is the original intension of this tests? Not sure I understand > > > what you are trying to test. > > it's a positive test that checks that extensions are available (both that > > the define is present, and that #pragma passes without error). > > > > I did not include negative tests (check that extension is not available > > outside of its respective context), because I think it's a bit overzealous > > reading of the specs. > > For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, > > but the text of the extension says that it is written against OpenCL 1.0.48 > > spec. (I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor > > can add vendor specific extensions to the list of supported extensions, it > > should be possible to add extensions from higher CL versions. > > > > similarly, I would argue against warnings for extensions promoted to core > > features (or at least hide the warning behind -pedantic). they are listed > > in CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to > > allow pragmas in higher CLC versions for backward compatibility. > I agree with this: > "similarly, I would argue against warnings for extensions promoted to core > features (or at least hide the warning behind -pedantic). they are listed in > CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow > pragmas in higher CLC versions for backward compatibility." > > @yaxunl, what's your opinion here? > > Regarding the test, I think we should still check the diagnostics being given > correctly especially for the extensions unavailable in the earlier versions. > It should be quite straight forward to extend this test. The warning is a reminder that this is no longer an extension and the user should remove that. However I do not have strong opinion on that. Repository: rL LLVM http://reviews.llvm.org/D20447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II
rmaprath added a comment. In http://reviews.llvm.org/D20320#439368, @bcraig wrote: > LGTM. You probably need to get an approval from someone else though, as I > haven't really established myself in the libunwind code base. > > As a side note... one of these days clang / llvm stack compaction may > actually work reasonably well, and tricks like this won't be necessary. I > look forward to that day. Thanks. Do you know if there are clang / llvm passes that attempts to achieve some sort of stack compaction? I couldn't find much. @jroelofs: Gentle ping. / Asiri http://reviews.llvm.org/D20320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20732: Don't use static variables in LambdaCapture
john.brawn created this revision. john.brawn added reviewers: faisalv, rsmith, jyknight. john.brawn added a subscriber: cfe-commits. john.brawn set the repository for this revision to rL LLVM. When static variables are used in inline functions in header files anything that uses that function ends up with a reference to the variable. Because RecursiveASTVisitor uses the inline functions in LambdaCapture that use static variables any AST plugin that uses RecursiveASTVisitor, such as the PrintFunctionNames example, ends up with a reference to these variables. This is bad on Windows when building with MSVC with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON as variables used across a DLL boundary need to be explicitly dllimported in the DLL using them. This patch avoids that by adjusting LambdaCapture to be similar to before r263921, with a capture of either 'this' or a VLA represented by a null Decl pointer in DeclAndBits with an extra flag added to the bits to distinguish between the two. This requires the use of an extra bit, and while Decl does happen to be sufficiently aligned to allow this it's done in a way that means PointerIntPair doesn't realise it and gives an assertion failure. Therefore I also adjust Decl slightly to use LLVM_ALIGNAS to allow this. Repository: rL LLVM http://reviews.llvm.org/D20732 Files: include/clang/AST/DeclBase.h include/clang/AST/LambdaCapture.h lib/AST/DeclBase.cpp lib/AST/ExprCXX.cpp Index: lib/AST/ExprCXX.cpp === --- lib/AST/ExprCXX.cpp +++ lib/AST/ExprCXX.cpp @@ -818,13 +818,10 @@ } } -LambdaCapture::OpaqueCapturedEntity LambdaCapture::ThisSentinel; -LambdaCapture::OpaqueCapturedEntity LambdaCapture::VLASentinel; - LambdaCapture::LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind, VarDecl *Var, SourceLocation EllipsisLoc) - : CapturedEntityAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) + : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc) { unsigned Bits = 0; if (Implicit) @@ -836,7 +833,7 @@ // Fall through case LCK_This: assert(!Var && "'this' capture cannot have a variable!"); -CapturedEntityAndBits.setPointer(&ThisSentinel); +Bits |= Capture_This; break; case LCK_ByCopy: @@ -847,19 +844,16 @@ break; case LCK_VLAType: assert(!Var && "VLA type capture cannot have a variable!"); -CapturedEntityAndBits.setPointer(&VLASentinel); break; } - CapturedEntityAndBits.setInt(Bits); + DeclAndBits.setInt(Bits); } LambdaCaptureKind LambdaCapture::getCaptureKind() const { - void *Ptr = CapturedEntityAndBits.getPointer(); - if (Ptr == &VLASentinel) + if (capturesVLAType()) return LCK_VLAType; - const unsigned Bits = CapturedEntityAndBits.getInt(); - bool CapByCopy = Bits & Capture_ByCopy; - if (Ptr == &ThisSentinel) + bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy; + if (capturesThis()) return CapByCopy ? LCK_StarThis : LCK_This; return CapByCopy ? LCK_ByCopy : LCK_ByRef; } Index: lib/AST/DeclBase.cpp === --- lib/AST/DeclBase.cpp +++ lib/AST/DeclBase.cpp @@ -46,7 +46,7 @@ } #define DECL(DERIVED, BASE)\ - static_assert(Decl::DeclObjAlignment >= \ + static_assert(llvm::AlignOf::Alignment >= \ llvm::AlignOf::Alignment, \ "Alignment sufficient after objects prepended to " #DERIVED); #define ABSTRACT_DECL(DECL) @@ -56,7 +56,7 @@ unsigned ID, std::size_t Extra) { // Allocate an extra 8 bytes worth of storage, which ensures that the // resulting pointer will still be 8-byte aligned. - static_assert(sizeof(unsigned) * 2 >= DeclObjAlignment, + static_assert(sizeof(unsigned) * 2 >= llvm::AlignOf::Alignment, "Decl won't be misaligned"); void *Start = Context.Allocate(Size + Extra + 8); void *Result = (char*)Start + 8; @@ -81,7 +81,8 @@ // Ensure required alignment of the resulting object by adding extra // padding at the start if required. size_t ExtraAlign = -llvm::OffsetToAlignment(sizeof(Module *), DeclObjAlignment); +llvm::OffsetToAlignment(sizeof(Module *), +llvm::AlignOf::Alignment); char *Buffer = reinterpret_cast( ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx)); Buffer += ExtraAlign; Index: include/clang/AST/LambdaCapture.h === --- include/clang/AST/LambdaCapture.h +++ include/clang/AST/LambdaCapture.h @@ -33,19 +33,21 @@ /// given capture was by-copy. /// /// This includes the case of a non-reference init-capture. -Capture_ByCopy = 0x
Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II
jroelofs accepted this revision. jroelofs added a comment. This revision is now accepted and ready to land. Probably worth doing the same thing for the non-EHABI non-SJLJ implementation, too (that can of course go in a separate commit). LGTM http://reviews.llvm.org/D20320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271000 - [mips] Compact branch policy setting.
Author: sdardis Date: Fri May 27 10:13:31 2016 New Revision: 271000 URL: http://llvm.org/viewvc/llvm-project?rev=271000&view=rev Log: [mips] Compact branch policy setting. This patch adds the commandline option -mcompact-branches={never,optimal,always), which controls how LLVM generates compact branches for MIPSR6 targets. By default, the compact branch policy is 'optimal' where LLVM will generate the most appropriate branch for any situation. The 'never' and 'always' policy will disable or always generate compact branches wherever possible respectfully. Reviewers: dsanders, vkalintiris, atanasyan Differential Revision: http://reviews.llvm.org/D20729 Modified: cfe/trunk/docs/UsersManual.rst cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Driver/Tools.h cfe/trunk/test/Driver/mips-features.c Modified: cfe/trunk/docs/UsersManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=271000&r1=270999&r2=271000&view=diff == --- cfe/trunk/docs/UsersManual.rst (original) +++ cfe/trunk/docs/UsersManual.rst Fri May 27 10:13:31 2016 @@ -1140,6 +1140,16 @@ are listed below. This option restricts the generated code to use general registers only. This only applies to the AArch64 architecture. +.. option:: -mcompact-branches=[values] + + Control the usage of compact branches for MIPSR6. + + Valid values are: ``never``, ``optimal`` and ``always``. + The default value is ``optimal`` which generates compact branches + when a delay slot cannot be filled. ``never`` disables the usage of + compact branches and ``always`` generates compact branches whenever + possible. + **-f[no-]max-type-align=[number]** Instruct the code generator to not enforce a higher alignment than the given number (of bytes) when accessing memory via an opaque pointer or reference. Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=271000&r1=270999&r2=271000&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri May 27 10:13:31 2016 @@ -238,6 +238,9 @@ def warn_target_unsupported_nan2008 : Wa def warn_target_unsupported_nanlegacy : Warning< "ignoring '-mnan=legacy' option because the '%0' architecture does not support it">, InGroup; +def warn_target_unsupported_compact_branches : Warning< + "ignoring '-mcompact-branches=' option because the '%0' architecture does not" + " support it">, InGroup; def warn_drv_unable_to_find_directory_expected : Warning< "unable to find %0 directory, expected to be in '%1'">, Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=271000&r1=270999&r2=271000&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri May 27 10:13:31 2016 @@ -56,6 +56,7 @@ def FloatConversion : def DoublePromotion : DiagGroup<"double-promotion">; def EnumTooLarge : DiagGroup<"enum-too-large">; def UnsupportedNan : DiagGroup<"unsupported-nan">; +def UnsupportedCB : DiagGroup<"unsupported-cb">; def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">; def NullConversion : DiagGroup<"null-conversion">; def ImplicitConversionFloatingPointToBool : Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=271000&r1=270999&r2=271000&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri May 27 10:13:31 2016 @@ -1621,6 +1621,7 @@ def mno_ldc1_sdc1 : Flag<["-"], "mno-ldc def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group; def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">, Group; +def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">, Group; def mdsp : Flag<["-"], "mdsp">, Group; def mno_dsp : Flag<["-"], "mno-dsp">, Group; def mdspr2 : Flag<["-"], "mdspr2">, Group; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271000&r1=270999&r2=271000&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fr
Re: [PATCH] D20729: [mips] Compact branch policy setting
This revision was automatically updated to reflect the committed changes. Closed by commit rL271000: [mips] Compact branch policy setting. (authored by sdardis). Changed prior to commit: http://reviews.llvm.org/D20729?vs=58778&id=58789#toc Repository: rL LLVM http://reviews.llvm.org/D20729 Files: cfe/trunk/docs/UsersManual.rst cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Driver/Tools.h cfe/trunk/test/Driver/mips-features.c Index: cfe/trunk/docs/UsersManual.rst === --- cfe/trunk/docs/UsersManual.rst +++ cfe/trunk/docs/UsersManual.rst @@ -1140,6 +1140,16 @@ This option restricts the generated code to use general registers only. This only applies to the AArch64 architecture. +.. option:: -mcompact-branches=[values] + + Control the usage of compact branches for MIPSR6. + + Valid values are: ``never``, ``optimal`` and ``always``. + The default value is ``optimal`` which generates compact branches + when a delay slot cannot be filled. ``never`` disables the usage of + compact branches and ``always`` generates compact branches whenever + possible. + **-f[no-]max-type-align=[number]** Instruct the code generator to not enforce a higher alignment than the given number (of bytes) when accessing memory via an opaque pointer or reference. Index: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td === --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td @@ -238,6 +238,9 @@ def warn_target_unsupported_nanlegacy : Warning< "ignoring '-mnan=legacy' option because the '%0' architecture does not support it">, InGroup; +def warn_target_unsupported_compact_branches : Warning< + "ignoring '-mcompact-branches=' option because the '%0' architecture does not" + " support it">, InGroup; def warn_drv_unable_to_find_directory_expected : Warning< "unable to find %0 directory, expected to be in '%1'">, Index: cfe/trunk/include/clang/Basic/DiagnosticGroups.td === --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td @@ -56,6 +56,7 @@ def DoublePromotion : DiagGroup<"double-promotion">; def EnumTooLarge : DiagGroup<"enum-too-large">; def UnsupportedNan : DiagGroup<"unsupported-nan">; +def UnsupportedCB : DiagGroup<"unsupported-cb">; def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">; def NullConversion : DiagGroup<"null-conversion">; def ImplicitConversionFloatingPointToBool : Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1621,6 +1621,7 @@ def mcheck_zero_division : Flag<["-"], "mcheck-zero-division">, Group; def mno_check_zero_division : Flag<["-"], "mno-check-zero-division">, Group; +def mcompact_branches_EQ : Joined<["-"], "mcompact-branches=">, Group; def mdsp : Flag<["-"], "mdsp">, Group; def mno_dsp : Flag<["-"], "mno-dsp">, Group; def mdspr2 : Flag<["-"], "mdspr2">, Group; Index: cfe/trunk/test/Driver/mips-features.c === --- cfe/trunk/test/Driver/mips-features.c +++ cfe/trunk/test/Driver/mips-features.c @@ -116,6 +116,24 @@ // RUN: | FileCheck --check-prefix=CHECK-NANLEGACY %s // CHECK-NANLEGACY: "-target-feature" "-nan2008" // +// -mcompact-branches=never +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=never 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBNEVER %s +// CHECK-CBNEVER: "-mllvm" "-mips-compact-branches=never" +// +// -mcompact-branches=optimal +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=optimal 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBOPTIMAL %s +// CHECK-CBOPTIMAL: "-mllvm" "-mips-compact-branches=optimal" +// +// -mcompact-branches=always +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: -mcompact-branches=always 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CBALWAYS %s +// CHECK-CBALWAYS: "-mllvm" "-mips-compact-branches=always" +// // -mxgot // RUN: %clang -target mips-linux-gnu -### -c %s \ // RUN: -mno-xgot -mxgot 2>&1 \ Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -1436,6 +1436,19 @@ CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v)); A->claim(); } + + if (Arg *A =
Re: [PATCH] D20729: [mips] Compact branch policy setting
sdardis added a comment. Thanks for the review. Repository: rL LLVM http://reviews.llvm.org/D20729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271001 - [OpenMP] Fix SEMA bug in the capture of global variables in template functions.
Author: sfantao Date: Fri May 27 10:21:27 2016 New Revision: 271001 URL: http://llvm.org/viewvc/llvm-project?rev=271001&view=rev Log: [OpenMP] Fix SEMA bug in the capture of global variables in template functions. Summary: Target regions require globals to be captured. This patch fixes a bug exposed when that happens in a template function. Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev Subscribers: guansong, ABataev, cfe-commits, caomhin, fraggamuffin Differential Revision: http://reviews.llvm.org/D18110 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=271001&r1=271000&r2=271001&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri May 27 10:21:27 2016 @@ -818,6 +818,9 @@ bool DSAStackTy::hasDirective( const DeclarationNameInfo &, SourceLocation)> &DPred, bool FromParent) { + // We look only in the enclosing region. + if (Stack.size() < 2) +return false; auto StartI = std::next(Stack.rbegin()); auto EndI = std::prev(Stack.rend()); if (FromParent && StartI != EndI) { @@ -990,8 +993,7 @@ VarDecl *Sema::IsOpenMPCapturedDecl(Valu if (DSAStack->getCurrentDirective() == OMPD_target && !DSAStack->isClauseParsingMode()) return VD; -if (DSAStack->getCurScope() && -DSAStack->hasDirective( +if (DSAStack->hasDirective( [](OpenMPDirectiveKind K, const DeclarationNameInfo &, SourceLocation) -> bool { return isOpenMPTargetExecutionDirective(K); Modified: cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp?rev=271001&r1=271000&r2=271001&view=diff == --- cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp (original) +++ cfe/trunk/test/OpenMP/target_codegen_global_capture.cpp Fri May 27 10:21:27 2016 @@ -21,6 +21,11 @@ // CHECK-DAG: [[BB:@.+]] = internal global float 1.00e+01 // CHECK-DAG: [[BC:@.+]] = internal global float 1.10e+01 // CHECK-DAG: [[BD:@.+]] = internal global float 1.20e+01 +// CHECK-DAG: [[TBA:@.+]] = {{.*}}global float 1.70e+01 +// CHECK-DAG: [[TBB:@.+]] = {{.*}}global float 1.80e+01 +// CHECK-DAG: [[TBC:@.+]] = {{.*}}global float 1.90e+01 +// CHECK-DAG: [[TBD:@.+]] = {{.*}}global float 2.00e+01 + double Ga = 1.0; double Gb = 2.0; double Gc = 3.0; @@ -42,14 +47,14 @@ int foo(short a, short b, short c, short static float Sd = 8.0; // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LB]], - // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb, - // CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3fooE2Sb, - // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc, + // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]], + // CHECK-DAG:[[VALFB:%.+]] = load float, float* [[FB]], + // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]], // CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LC]], - // CHECK-DAG:[[VALFC:%.+]] = load float, float* @_ZZ3fooE2Sc, + // CHECK-DAG:[[VALFC:%.+]] = load float, float* [[FC]], // CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LD]], - // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* @Gd, - // CHECK-DAG:[[VALFD:%.+]] = load float, float* @_ZZ3fooE2Sd, + // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]], + // CHECK-DAG:[[VALFD:%.+]] = load float, float* [[FD]], // 3 local vars being captured. @@ -178,14 +183,156 @@ int bar(short a, short b, short c, short #pragma omp parallel { // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LLB]], -// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb, -// CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3barE2Sb, -// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc, +// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]], +// CHECK-DAG:[[VALFB:%.+]] = load float, float* [[BB]], +// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]], +// CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LLC]], +// CHECK-DAG:[[VALFC:%.+]] = load float, float* [[BC]], +// CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LLD]], +// CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]], +// CHECK-DAG:[[VALFD:%.+]] = load float, float* [[BD]], + +// 3 local vars being captured. + +// CHECK-DAG: store i16 [[VALLB]], i16* [[CONVLB:%.+]], +// CHECK-DAG: [[CONVLB]] = bitcast i[[sz:64|32]]* [[CADDRLB:%.+]] to i16* +// CHECK-DAG: [[CVALLB:%.+]] = load i[[sz]], i[[sz]]* [[
Re: [PATCH] D20090: [OPENCL] Fix wrongly vla error for OpenCL array.
Anastasia added inline comments. Comment at: test/CodeGenOpenCL/vla.cl:1 @@ +1,2 @@ +// RUN: %clang_cc1 -emit-llvm -O0 -o - %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -DCL20 -o - %s | FileCheck %s --check-prefix=CL20 pxli168 wrote: > Anastasia wrote: > > pxli168 wrote: > > > Anastasia wrote: > > > > Could we have a Sema test instead where we accept the VLA if constant > > > > AS object is used and give an error otherwise? > > > > > > > > Also do we need to test CL2.0? We don't seem to be doing anything > > > > different for that version. > > > In earier than OpenCL1.2 program scope variable must reside in constant > > > address space and no > > > ``` > > > const global int > > > ``` > > > can be here. > > > But const global value should also not be seen as VLA either. > > Why not? Could you write a complete example perhaps? I am not sure I > > understand your point. > > > > Thanks! > Oh, I mean that in OpenCL 1.2 there will be some error message with > ``` > const global int > ``` > But I want to have a test with something that not only with the constant > address space. > Or what you suggest is that I make all the test in OpenCL 2.0? Yes, I think this should be enough for testing your change. http://reviews.llvm.org/D20090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19780: Output OpenCL version in Clang diagnostics
rivanvx added a comment. @Anastasia I looked into introducing a separate getOpenCLVersion() function (or perhaps three - major version, minor version and version string). This would have to be used in lib/CodeGen/TargetInfo.cpp and lib/Parse/ParseDecl.cpp, and I am undecided on where should one put this code. One option would be in Parse/Parser.h inside class Parser, and then TargetInfo.cpp would have to include Parser.h, unless we decide to declare it inside AST/ASTContext.h. In any case, this has so far two usages, and they are different (major and minor version in TargetInfo.cpp vs version string in ParseDecl.cpp). Therefore, I would propose to leave this as is for now, and rethink it after the same code has to be used in more places. http://reviews.llvm.org/D19780 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r271004 - [libunwind] Improve unwinder stack usage - II
Author: asiri Date: Fri May 27 10:41:45 2016 New Revision: 271004 URL: http://llvm.org/viewvc/llvm-project?rev=271004&view=rev Log: [libunwind] Improve unwinder stack usage - II unwind_phase1 and unwind_phase2 allocate their own copies of unw_cursor_t buffers on the stack. This can blow-up stack usage of the unwinder depending on how these two functions get inlined into _Unwind_RaiseException. Clang seems to inline unwind_phase1 into _Unwind_RaiseException but not unwind_phase2, thus creating two unw_cursor_t buffers on the stack. One way to work-around this problem is to mark both unwind_phase1 and unwind_phase2 as noinline. This patch takes the less compiler-dependent approach and explicitly allocate a unw_cursor_t buffer and pass that into unwind_phase1 and unwind_phase2 functions. A follow-up patch will replicate this behavior for the non-EHABI and non-SJLJ implementations. Reviewers: jroelofs, bcraig. Differential revision: http://reviews.llvm.org/D20320 Modified: libunwind/trunk/src/Unwind-EHABI.cpp Modified: libunwind/trunk/src/Unwind-EHABI.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-EHABI.cpp?rev=271004&r1=271003&r2=271004&view=diff == --- libunwind/trunk/src/Unwind-EHABI.cpp (original) +++ libunwind/trunk/src/Unwind-EHABI.cpp Fri May 27 10:41:45 2016 @@ -438,15 +438,14 @@ extern "C" _Unwind_Reason_Code __aeabi_u } static _Unwind_Reason_Code -unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) { +unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { // EHABI #7.3 discusses preserving the VRS in a "temporary VRS" during // phase 1 and then restoring it to the "primary VRS" for phase 2. The // effect is phase 2 doesn't see any of the VRS manipulations from phase 1. // In this implementation, the phases don't share the VRS backing store. // Instead, they are passed the original |uc| and they create a new VRS // from scratch thus achieving the same effect. - unw_cursor_t cursor1; - unw_init_local(&cursor1, uc); + unw_init_local(cursor, uc); // Walk each frame looking for a place to stop. for (bool handlerNotFound = true; handlerNotFound;) { @@ -454,7 +453,7 @@ unwind_phase1(unw_context_t *uc, _Unwind #if !_LIBUNWIND_ARM_EHABI // Ask libuwind to get next frame (skip over first which is // _Unwind_RaiseException). -int stepResult = unw_step(&cursor1); +int stepResult = unw_step(cursor); if (stepResult == 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached " "bottom => _URC_END_OF_STACK\n", @@ -470,7 +469,7 @@ unwind_phase1(unw_context_t *uc, _Unwind // See if frame has code to run (has personality routine). unw_proc_info_t frameInfo; -if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) { +if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " "failed => _URC_FATAL_PHASE1_ERROR\n", static_cast(exception_object)); @@ -482,12 +481,12 @@ unwind_phase1(unw_context_t *uc, _Unwind char functionBuf[512]; const char *functionName = functionBuf; unw_word_t offset; - if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf), + if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), &offset) != UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip)) functionName = ".anonymous."; unw_word_t pc; - unw_get_reg(&cursor1, UNW_REG_IP, &pc); + unw_get_reg(cursor, UNW_REG_IP, &pc); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, " "lsda=0x%llX, personality=0x%llX\n", @@ -505,7 +504,7 @@ unwind_phase1(unw_context_t *uc, _Unwind "unwind_phase1(ex_ojb=%p): calling personality function %p\n", static_cast(exception_object), reinterpret_cast(reinterpret_cast(p))); - struct _Unwind_Context *context = (struct _Unwind_Context *)(&cursor1); + struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor); exception_object->pr_cache.fnstart = frameInfo.start_ip; exception_object->pr_cache.ehtp = (_Unwind_EHT_Header *)frameInfo.unwind_info; @@ -553,12 +552,11 @@ unwind_phase1(unw_context_t *uc, _Unwind return _URC_NO_REASON; } -static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, +static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object, bool resume) { // See comment at the start of unwind_phase1 regarding VRS integrity. - unw_cur
Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II
This revision was automatically updated to reflect the committed changes. Closed by commit rL271004: [libunwind] Improve unwinder stack usage - II (authored by asiri). Changed prior to commit: http://reviews.llvm.org/D20320?vs=57452&id=58794#toc Repository: rL LLVM http://reviews.llvm.org/D20320 Files: libunwind/trunk/src/Unwind-EHABI.cpp Index: libunwind/trunk/src/Unwind-EHABI.cpp === --- libunwind/trunk/src/Unwind-EHABI.cpp +++ libunwind/trunk/src/Unwind-EHABI.cpp @@ -438,23 +438,22 @@ } static _Unwind_Reason_Code -unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) { +unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { // EHABI #7.3 discusses preserving the VRS in a "temporary VRS" during // phase 1 and then restoring it to the "primary VRS" for phase 2. The // effect is phase 2 doesn't see any of the VRS manipulations from phase 1. // In this implementation, the phases don't share the VRS backing store. // Instead, they are passed the original |uc| and they create a new VRS // from scratch thus achieving the same effect. - unw_cursor_t cursor1; - unw_init_local(&cursor1, uc); + unw_init_local(cursor, uc); // Walk each frame looking for a place to stop. for (bool handlerNotFound = true; handlerNotFound;) { #if !_LIBUNWIND_ARM_EHABI // Ask libuwind to get next frame (skip over first which is // _Unwind_RaiseException). -int stepResult = unw_step(&cursor1); +int stepResult = unw_step(cursor); if (stepResult == 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached " "bottom => _URC_END_OF_STACK\n", @@ -470,7 +469,7 @@ // See if frame has code to run (has personality routine). unw_proc_info_t frameInfo; -if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) { +if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " "failed => _URC_FATAL_PHASE1_ERROR\n", static_cast(exception_object)); @@ -482,12 +481,12 @@ char functionBuf[512]; const char *functionName = functionBuf; unw_word_t offset; - if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf), + if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), &offset) != UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip)) functionName = ".anonymous."; unw_word_t pc; - unw_get_reg(&cursor1, UNW_REG_IP, &pc); + unw_get_reg(cursor, UNW_REG_IP, &pc); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, " "lsda=0x%llX, personality=0x%llX\n", @@ -505,7 +504,7 @@ "unwind_phase1(ex_ojb=%p): calling personality function %p\n", static_cast(exception_object), reinterpret_cast(reinterpret_cast(p))); - struct _Unwind_Context *context = (struct _Unwind_Context *)(&cursor1); + struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor); exception_object->pr_cache.fnstart = frameInfo.start_ip; exception_object->pr_cache.ehtp = (_Unwind_EHT_Header *)frameInfo.unwind_info; @@ -553,12 +552,11 @@ return _URC_NO_REASON; } -static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, +static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object, bool resume) { // See comment at the start of unwind_phase1 regarding VRS integrity. - unw_cursor_t cursor2; - unw_init_local(&cursor2, uc); + unw_init_local(cursor, uc); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n", static_cast(exception_object)); @@ -580,13 +578,13 @@ // for. After this, continue unwinding as if normal. // // See #7.4.6 for details. - unw_set_reg(&cursor2, UNW_REG_IP, + unw_set_reg(cursor, UNW_REG_IP, exception_object->unwinder_cache.reserved2); resume = false; } #if !_LIBUNWIND_ARM_EHABI -int stepResult = unw_step(&cursor2); +int stepResult = unw_step(cursor); if (stepResult == 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " "bottom => _URC_END_OF_STACK\n", @@ -603,8 +601,8 @@ // Get info about this frame. unw_word_t sp; unw_proc_info_t frameInfo; -unw_get_reg(&cursor2, UNW_REG_SP, &sp); -if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) { +unw_get_reg(cursor, UNW_REG_SP, &sp); +if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.
Anastasia added a comment. Since it has been in review for quite a while, should we try to commit it ASAP? I think Richard can give us his feedback later as well. http://reviews.llvm.org/D18369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19780: Output OpenCL version in Clang diagnostics
Anastasia added a comment. In http://reviews.llvm.org/D19780#442305, @rivanvx wrote: > @Anastasia I looked into introducing a separate getOpenCLVersion() function > (or perhaps three - major version, minor version and version string). This > would have to be used in lib/CodeGen/TargetInfo.cpp and > lib/Parse/ParseDecl.cpp, and I am undecided on where should one put this > code. One option would be in Parse/Parser.h inside class Parser, and then > TargetInfo.cpp would have to include Parser.h, unless we decide to declare it > inside AST/ASTContext.h. > > In any case, this has so far two usages, and they are different (major and > minor version in TargetInfo.cpp vs version string in ParseDecl.cpp). > Therefore, I would propose to leave this as is for now, and rethink it after > the same code has to be used in more places. Sure! It seems to make sense to me to have more use cases first. ;) Thanks for looking at it! http://reviews.llvm.org/D19780 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271005 - [msan] add a sentence about inline assembly
Author: kcc Date: Fri May 27 10:49:32 2016 New Revision: 271005 URL: http://llvm.org/viewvc/llvm-project?rev=271005&view=rev Log: [msan] add a sentence about inline assembly Modified: cfe/trunk/docs/MemorySanitizer.rst Modified: cfe/trunk/docs/MemorySanitizer.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/MemorySanitizer.rst?rev=271005&r1=271004&r2=271005&view=diff == --- cfe/trunk/docs/MemorySanitizer.rst (original) +++ cfe/trunk/docs/MemorySanitizer.rst Fri May 27 10:49:32 2016 @@ -171,6 +171,8 @@ Handling external code MemorySanitizer requires that all program code is instrumented. This also includes any libraries that the program depends on, even libc. Failing to achieve this may result in false reports. +For the same reason you may need to replace all inline assembly code that writes to memory +with a pure C/C++ code. Full MemorySanitizer instrumentation is very difficult to achieve. To make it easier, MemorySanitizer runtime library includes 70+ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } The range for a single token is a single location. The problem is your test. The range for "throw()" ends at the start of the ')' token. For "noexcept", the beginning and end are the same location, e.g., here's how "int" is tested: ``` TEST(MatchVerifier, ParseError) { LocationVerifier Verifier; Verifier.expectLocation(1, 1); EXPECT_FALSE(Verifier.match("int i", varDecl())); } ``` I think you should use this instead: ``` SourceRange NoexceptRange(Tok.getLocation()); ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271010 - Add instcombine pass if sampleprofile pass is enabled.
Author: dehao Date: Fri May 27 11:14:35 2016 New Revision: 271010 URL: http://llvm.org/viewvc/llvm-project?rev=271010&view=rev Log: Add instcombine pass if sampleprofile pass is enabled. Summary: Sample profile pass need to have instcombine pass. A related change is http://reviews.llvm.org/D17742. But we should not explicitly add dependency between to non-analysis passes. So we add the dependency here. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20502 Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=271010&r1=271009&r2=271010&view=diff == --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original) +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri May 27 11:14:35 2016 @@ -178,6 +178,11 @@ static void addAddDiscriminatorsPass(con PM.add(createAddDiscriminatorsPass()); } +static void addInstructionCombiningPass(const PassManagerBuilder &Builder, +legacy::PassManagerBase &PM) { + PM.add(createInstructionCombiningPass()); +} + static void addBoundsCheckingPass(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { PM.add(createBoundsCheckingPass()); @@ -441,7 +446,6 @@ void EmitAssemblyHelper::CreatePasses(Mo legacy::FunctionPassManager *FPM = getPerFunctionPasses(); if (CodeGenOpts.VerifyModule) FPM->add(createVerifierPass()); - PMBuilder.populateFunctionPassManager(*FPM); // Set up the per-module pass manager. if (!CodeGenOpts.RewriteMapFiles.empty()) @@ -480,9 +484,13 @@ void EmitAssemblyHelper::CreatePasses(Mo if (CodeGenOpts.hasProfileIRUse()) PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; - if (!CodeGenOpts.SampleProfileFile.empty()) + if (!CodeGenOpts.SampleProfileFile.empty()) { MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); +PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, + addInstructionCombiningPass); + } + PMBuilder.populateFunctionPassManager(*FPM); PMBuilder.populateModulePassManager(*MPM); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20734: [clang-format] insert new #includes into correct blocks when cleaning up Replacement with cleanupAroundReplacements().
ioeric created this revision. ioeric added reviewers: djasper, klimek. ioeric added subscribers: bkramer, cfe-commits. Herald added a subscriber: klimek. When a replacement's offset is set to UINT_MAX or -1U, it is treated as a header insertion replacement by cleanupAroundReplacements(). The new #include directive is then inserted into the correct block. http://reviews.llvm.org/D20734 Files: include/clang/Format/Format.h lib/Format/Format.cpp unittests/Format/CleanupTest.cpp Index: unittests/Format/CleanupTest.cpp === --- unittests/Format/CleanupTest.cpp +++ unittests/Format/CleanupTest.cpp @@ -281,6 +281,294 @@ EXPECT_EQ(Expected, applyAllReplacements(Code, FinalReplaces)); } +TEST_F(CleanUpReplacementsTest, NoExistingIncludeWithoutDefine) { + std::string Code = "int main() {}"; + std::string Expected = "#include \"a.h\"\n" + "int main() {}"; + Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"a.h\"")); + format::FormatStyle Style = format::getLLVMStyle(); + auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces)); +} + +TEST_F(CleanUpReplacementsTest, NoExistingIncludeWithDefine) { + std::string Code = "#ifndef __A_H__\n" + "#define __A_H__\n" + "class A {};\n" + "#define MMM 123\n" + "#endif"; + std::string Expected = "#ifndef __A_H__\n" + "#define __A_H__\n" + "\n" + "#include \"b.h\"\n" + "class A {};\n" + "#define MMM 123\n" + "#endif"; + + Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"b.h\"")); + format::FormatStyle Style = format::getLLVMStyle(); + auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces)); +} + +TEST_F(CleanUpReplacementsTest, InsertAfterMainHeader) { + std::string Code = "#include \"fix.h\"\n" + "\n" + "int main() {}"; + std::string Expected = "#include \"fix.h\"\n" + "#include \n" + "\n" + "int main() {}"; + Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include ")); + format::FormatStyle Style = + format::getGoogleStyle(format::FormatStyle::LanguageKind::LK_Cpp); + auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces)); +} + +TEST_F(CleanUpReplacementsTest, InsertBeforeSystemHeaderLLVM) { + std::string Code = "#include \n" + "\n" + "int main() {}"; + std::string Expected = "#include \"z.h\"\n" + "#include \n" + "\n" + "int main() {}"; + Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"z.h\"")); + format::FormatStyle Style = format::getLLVMStyle(); + auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces)); +} + +TEST_F(CleanUpReplacementsTest, InsertAfterSystemHeaderGoogle) { + std::string Code = "#include \n" + "\n" + "int main() {}"; + std::string Expected = "#include \n" + "#include \"z.h\"\n" + "\n" + "int main() {}"; + Context.createInMemoryFile("fix.cpp", Code); + tooling::Replacements Replaces; + Replaces.insert(tooling::Replacement("fix.cpp", -1U, 0, "#include \"z.h\"")); + format::FormatStyle Style = + format::getGoogleStyle(format::FormatStyle::LanguageKind::LK_Cpp); + auto NewReplaces = cleanupAroundReplacements(Code, Replaces, Style); + EXPECT_EQ(Expected, applyAllReplacements(Code, NewReplaces)); +} + +TEST_F(CleanUpReplacementsTest, InsertOneIncludeLLVMStyle) { + std::string Code = "#include \"x/fix.h\"\n" + "#include \"a.h\"\n" + "#include \"b.h\"\n" + "#include \"clang/Format/Format.h\"\n" + "#include \n"; + std::string Expected = "#include \"x/fix.h\"\n" + "#include \"a.h\"\n" + "#include \"b.h\"\n" + "#include \"d.h\"\n" + "#include \"clang/Format/Format.h\"\n" + "#include \"llvm/x
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } hintonda wrote: > The range for a single token is a single location. The problem is your test. > The range for "throw()" ends at the start of the ')' token. For "noexcept", > the beginning and end are the same location, e.g., here's how "int" is tested: > > ``` > TEST(MatchVerifier, ParseError) { > LocationVerifier Verifier; > Verifier.expectLocation(1, 1); > EXPECT_FALSE(Verifier.match("int i", varDecl())); > } > ``` > > I think you should use this instead: > > ``` > SourceRange NoexceptRange(Tok.getLocation()); > ``` Pasted the wrong test -- this one does the range: ``` TEST(RangeVerifier, WrongRange) { RangeVerifier Verifier; Verifier.expectRange(1, 1, 1, 1); EXPECT_FALSE(Verifier.match("int i;", varDecl())); } ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20617: [X86][SSE] _mm_store1_ps/_mm_store1_pd should require an aligned pointer
RKSimon added inline comments. Comment at: lib/Headers/emmintrin.h:598 @@ -594,3 +597,3 @@ static __inline__ void __DEFAULT_FN_ATTRS -_mm_store_pd(double *__dp, __m128d __a) +_mm_store_pd1(double *__dp, __m128d __a) { majnemer wrote: > You could use `__attribute__((align_value(16)))` no? Technically yes but AFAICT there are no other users of this approach in the headers - is it something that we should be encouraging do you think? Craig - I think you wrote in a commit about dropping the unaligned intrinsics, is that how you'd do it? Repository: rL LLVM http://reviews.llvm.org/D20617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
aaron.ballman added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } hintonda wrote: > The range for a single token is a single location. The problem is your test. > The range for "throw()" ends at the start of the ')' token. For "noexcept", > the beginning and end are the same location, e.g., here's how "int" is tested: > > ``` > TEST(MatchVerifier, ParseError) { > LocationVerifier Verifier; > Verifier.expectLocation(1, 1); > EXPECT_FALSE(Verifier.match("int i", varDecl())); > } > ``` > > I think you should use this instead: > > ``` > SourceRange NoexceptRange(Tok.getLocation()); > ``` Ah, how interesting; I would have assumed the range would be the full range of the source involved, but I forgot, that's what char ranges are for. http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes
Eugene.Zelenko updated this revision to Diff 58803. Eugene.Zelenko added a comment. More diff content. Repository: rL LLVM http://reviews.llvm.org/D20714 Files: clang-tidy/ClangTidy.cpp clang-tidy/ClangTidy.h clang-tidy/ClangTidyDiagnosticConsumer.cpp clang-tidy/ClangTidyDiagnosticConsumer.h clang-tidy/ClangTidyModule.cpp clang-tidy/ClangTidyModule.h clang-tidy/ClangTidyOptions.cpp clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h clang-tidy/llvm/HeaderGuardCheck.cpp clang-tidy/llvm/HeaderGuardCheck.h clang-tidy/tool/ClangTidyMain.cpp clang-tidy/utils/OptionsUtils.cpp clang-tidy/utils/OptionsUtils.h Index: clang-tidy/tool/ClangTidyMain.cpp === --- clang-tidy/tool/ClangTidyMain.cpp +++ clang-tidy/tool/ClangTidyMain.cpp @@ -16,11 +16,26 @@ //===--===// #include "../ClangTidy.h" +#include "../ClangTidyDiagnosticConsumer.h" +#include "../ClangTidyOptions.h" #include "clang/Tooling/CommonOptionsParser.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Process.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Timer.h" +#include +#include +#include +#include +#include +#include using namespace clang::ast_matchers; -using namespace clang::driver; using namespace clang::tooling; using namespace llvm; Index: clang-tidy/ClangTidyOptions.cpp === --- clang-tidy/ClangTidyOptions.cpp +++ clang-tidy/ClangTidyOptions.cpp @@ -10,13 +10,18 @@ #include "ClangTidyOptions.h" #include "ClangTidyModuleRegistry.h" #include "clang/Basic/LLVM.h" +#include "llvm/ADT/None.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/Errc.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/YAMLTraits.h" #include "llvm/Support/raw_ostream.h" +#include +#include +#include #include #define DEBUG_TYPE "clang-tidy-options" @@ -50,6 +55,7 @@ IO.mapRequired("name", File.Name); IO.mapOptional("lines", File.LineRanges); } + static StringRef validate(IO &io, FileFilter &File) { if (File.Name.empty()) return "No file name specified"; @@ -72,12 +78,14 @@ NOptionMap(IO &) {} NOptionMap(IO &, const ClangTidyOptions::OptionMap &OptionMap) : Options(OptionMap.begin(), OptionMap.end()) {} + ClangTidyOptions::OptionMap denormalize(IO &) { ClangTidyOptions::OptionMap Map; for (const auto &KeyValue : Options) Map[KeyValue.first] = KeyValue.second; return Map; } + std::vector Options; }; Index: clang-tidy/ClangTidyModule.h === --- clang-tidy/ClangTidyModule.h +++ clang-tidy/ClangTidyModule.h @@ -14,8 +14,10 @@ #include "llvm/ADT/StringRef.h" #include #include +#include #include -#include +#include +#include "ClangTidyOptions.h" namespace clang { namespace tidy { Index: clang-tidy/llvm/HeaderGuardCheck.cpp === --- clang-tidy/llvm/HeaderGuardCheck.cpp +++ clang-tidy/llvm/HeaderGuardCheck.cpp @@ -8,6 +8,10 @@ //===--===// #include "HeaderGuardCheck.h" +#include "clang/Tooling/Tooling.h" +#include +#include +#include namespace clang { namespace tidy { Index: clang-tidy/llvm/HeaderGuardCheck.h === --- clang-tidy/llvm/HeaderGuardCheck.h +++ clang-tidy/llvm/HeaderGuardCheck.h @@ -11,6 +11,8 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H #include "../utils/HeaderGuard.h" +#include "llvm/ADT/StringRef.h" +#include namespace clang { namespace tidy { Index: clang-tidy/ClangTidyModule.cpp === --- clang-tidy/ClangTidyModule.cpp +++ clang-tidy/ClangTidyModule.cpp @@ -12,6 +12,8 @@ //===--===// #include "ClangTidyModule.h" +#include "ClangTidy.h" +#include "ClangTidyDiagnosticConsumer.h" namespace clang { namespace tidy { Index: clang-tidy/ClangTidy.h === --- clang-tidy/ClangTidy.h +++ clang-tidy/ClangTidy.h @@ -14,12 +14,18 @@ #include "ClangTidyOptions.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/Diagnostic.h" -#include "clang/Basic/SourceManager.h" -#include "clang/Tooling/Refactoring.h" -#in
Re: [PATCH] D20428: Tracking exception specification source locations
aaron.ballman updated this revision to Diff 58804. aaron.ballman marked 3 inline comments as done. aaron.ballman added a comment. Updating based on further review comments. http://reviews.llvm.org/D20428 Files: include/clang/AST/Decl.h include/clang/AST/TypeLoc.h lib/AST/Decl.cpp lib/Sema/SemaType.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp unittests/AST/SourceLocationTest.cpp Index: unittests/AST/SourceLocationTest.cpp === --- unittests/AST/SourceLocationTest.cpp +++ unittests/AST/SourceLocationTest.cpp @@ -580,5 +580,72 @@ Language::Lang_CXX11)); } +class ExceptionSpecRangeVerifier : public RangeVerifier { +protected: + SourceRange getRange(const TypeLoc &Node) override { +auto T = + Node.getUnqualifiedLoc().castAs(); +assert(!T.isNull()); +return T.getExceptionSpecRange(); + } +}; + +class ParmVarExceptionSpecRangeVerifier : public RangeVerifier { +protected: + SourceRange getRange(const ParmVarDecl &Node) override { +if (const TypeSourceInfo *TSI = Node.getTypeSourceInfo()) { + TypeLoc TL = TSI->getTypeLoc(); + if (TL.getType()->isPointerType()) { +TL = TL.getNextTypeLoc().IgnoreParens(); +if (auto FPTL = TL.getAs()) { + return FPTL.getExceptionSpecRange(); +} + } +} +return SourceRange(); + } +}; + +TEST(FunctionDecl, ExceptionSpecifications) { + ExceptionSpecRangeVerifier Verifier; + + Verifier.expectRange(1, 10, 1, 16); + EXPECT_TRUE(Verifier.match("void f() throw();\n", loc(functionType(; + + Verifier.expectRange(1, 10, 1, 34); + EXPECT_TRUE(Verifier.match("void f() throw(void(void) throw());\n", + loc(functionType(; + + Verifier.expectRange(1, 10, 1, 19); + std::vector Args; + Args.push_back("-fms-extensions"); + EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()), + Args, Language::Lang_CXX)); + + Verifier.expectRange(1, 10, 1, 10); + EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()), + Language::Lang_CXX11)); + + Verifier.expectRange(1, 10, 1, 24); + EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()), + Language::Lang_CXX11)); + + Verifier.expectRange(1, 10, 1, 32); + EXPECT_TRUE(Verifier.match("void f() noexcept(noexcept(1+1));\n", + loc(functionType()), Language::Lang_CXX11)); + + ParmVarExceptionSpecRangeVerifier Verifier2; + Verifier2.expectRange(1, 25, 1, 31); + EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) throw());\n", + parmVarDecl(hasType(pointerType(pointee( + parenType(innerType(functionType(); + + Verifier2.expectRange(1, 25, 1, 38); + EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) noexcept(true));\n", + parmVarDecl(hasType(pointerType(pointee( + parenType(innerType(functionType())), + Language::Lang_CXX11)); +} + } // end namespace ast_matchers } // end namespace clang Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -572,6 +572,7 @@ Record.AddSourceLocation(TL.getLocalRangeBegin()); Record.AddSourceLocation(TL.getLParenLoc()); Record.AddSourceLocation(TL.getRParenLoc()); + Record.AddSourceRange(TL.getExceptionSpecRange()); Record.AddSourceLocation(TL.getLocalRangeEnd()); for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) Record.AddDeclRef(TL.getParam(i)); Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -5812,6 +5812,8 @@ TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx)); TL.setLParenLoc(ReadSourceLocation(Record, Idx)); TL.setRParenLoc(ReadSourceLocation(Record, Idx)); + TL.setExceptionSpecRange(SourceRange(ReadSourceLocation(Record, Idx), + ReadSourceLocation(Record, Idx))); TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx)); for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) { TL.setParam(i, ReadDeclAs(Record, Idx)); Index: lib/Sema/TreeTransform.h === --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -4942,6 +4942,7 @@ NewTL.setLocalRangeBegin(TL.getLocalRangeBegin()); NewTL.setLParenLoc(TL.getLParenLoc()); NewTL.setRParenLoc(TL.getRParenLoc()); + NewTL.setExceptionSpecRange(TL.getExceptionSpecRange()); NewTL.setLocalRangeEnd(TL.getLocalRangeEnd()); for (unsigned i = 0, e = NewTL.getNumParams(); i !=
Re: [PATCH] D20428: Tracking exception specification source locations
On Fri, May 27, 2016 at 12:19 PM, don hinton wrote: > hintonda added inline comments. > > > Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 > @@ -3402,6 +3402,7 @@ >// If we already had a dynamic specification, parse the noexcept for, >// recovery, but emit a diagnostic and don't store the results. > - SourceRange NoexceptRange; > + SourceRange NoexceptRange(Tok.getLocation(), > +Tok.getEndLoc().getLocWithOffset(-1)); >ExceptionSpecificationType NoexceptType = EST_None; > >SourceLocation KeywordLoc = ConsumeToken(); > > @@ -3424,6 +3425,5 @@ >} else { > // There is no argument. > NoexceptType = EST_BasicNoexcept; > -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); >} > > > The range for a single token is a single location. The problem is your test. > The range for "throw()" ends at the start of the ')' token. For "noexcept", > the beginning and end are the same location, e.g., here's how "int" is tested: That's right! I forgot that source ranges are not *char* source ranges but token source ranges. Thank you for the reminder. ~Aaron > > ``` > TEST(MatchVerifier, ParseError) { > LocationVerifier Verifier; > Verifier.expectLocation(1, 1); > EXPECT_FALSE(Verifier.match("int i", varDecl())); > } > ``` > > I think you should use this instead: > > ``` > SourceRange NoexceptRange(Tok.getLocation()); > ``` > > > http://reviews.llvm.org/D20428 > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.
alexeagle added a comment. ping @djasper we need this fix in order to format angular 2 repo again http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } hintonda wrote: > aaron.ballman wrote: > > hintonda wrote: > > > The range for a single token is a single location. The problem is your > > > test. The range for "throw()" ends at the start of the ')' token. For > > > "noexcept", the beginning and end are the same location, e.g., here's how > > > "int" is tested: > > > > > > ``` > > > TEST(MatchVerifier, ParseError) { > > > LocationVerifier Verifier; > > > Verifier.expectLocation(1, 1); > > > EXPECT_FALSE(Verifier.match("int i", varDecl())); > > > } > > > ``` > > > > > > I think you should use this instead: > > > > > > ``` > > > SourceRange NoexceptRange(Tok.getLocation()); > > > ``` > > Ah, how interesting; I would have assumed the range would be the full range > > of the source involved, but I forgot, that's what char ranges are for. > Pasted the wrong test -- this one does the range: > > ``` > TEST(RangeVerifier, WrongRange) { > RangeVerifier Verifier; > Verifier.expectRange(1, 1, 1, 1); > EXPECT_FALSE(Verifier.match("int i;", varDecl())); > } > ``` Sorry, looked at wrong tests -- should have looked at multi-character ending tokens. ``` NoexceptRange = SourceRange( Tok.getLocation(), Tok.getLocation().getLocWithOffset(Tok.getLength())); ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II
bcraig added a comment. In http://reviews.llvm.org/D20320#442246, @rmaprath wrote: > Do you know if there are clang / llvm passes that attempts to achieve some > sort of stack compaction? I couldn't find much. I'm not sure if it belongs to its own pass, or if it is part of another pass, but the algorithm and discussion revolve around the term "stack coloring". The code lives in llvm lib/CodeGen/StackColoring. Here's a recent review that messed with it: http://reviews.llvm.org/D18827 Repository: rL LLVM http://reviews.llvm.org/D20320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20730: [libcxx] Prefer UNSUPPORTED over conditional compilation for tests
bcraig added subscribers: mclow.lists, bcraig. bcraig added a comment. LGTM. Add @mclow.lists as a reviewer. http://reviews.llvm.org/D20730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.
mprobst added a comment. Alex, do you accept this revision? http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20447: [OpenCL] Fixup extension list
jvesely updated this revision to Diff 58806. jvesely added a comment. add detection of extensions in early CL versions to test. Repository: rL LLVM http://reviews.llvm.org/D20447 Files: include/clang/Basic/OpenCLExtensions.def test/SemaOpenCL/extension-version.cl Index: test/SemaOpenCL/extension-version.cl === --- /dev/null +++ test/SemaOpenCL/extension-version.cl @@ -0,0 +1,225 @@ +// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown + +#if __OPENCL_C_VERSION__ >= 200 +// expected-no-diagnostics +#endif + +// Extensions in all versions +#ifndef cl_clang_storage_class_specifiers +#error "Missing cl_clang_storage_class_specifiers define" +#endif +#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable + +#ifndef cl_khr_fp16 +#error "Missing cl_khr_fp16 define" +#endif +#pragma OPENCL EXTENSION cl_khr_fp16: enable + +#ifndef cl_khr_int64_base_atomics +#error "Missing cl_khr_int64_base_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable + +#ifndef cl_khr_int64_extended_atomics +#error "Missing cl_khr_int64_extended_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable + +#ifndef cl_khr_gl_sharing +#error "Missing cl_khr_gl_sharing define" +#endif +#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable + +#ifndef cl_khr_icd +#error "Missing cl_khr_icd define" +#endif +#pragma OPENCL EXTENSION cl_khr_icd: enable + +// COre features in CL 1.1 +#if (__OPENCL_C_VERSION__ < 110) +#ifndef cl_khr_byte_addressable_store +#error "Missing cl_khr_byte_addressable_store define" +#endif +#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable + +#ifndef cl_khr_global_int32_base_atomics +#error "Missing cl_khr_global_int32_base_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable + +#ifndef cl_khr_global_int32_extended_atomics +#error "Missing cl_khr_global_int32_extended_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable + +#ifndef cl_khr_local_int32_base_atomics +#error "Missing cl_khr_local_int32_base_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable + +#ifndef cl_khr_local_int32_extended_atomics +#error "Missing cl_khr_local_int32_extended_atomics define" +#endif +#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable + +#ifndef cl_khr_select_fprounding_mode +#error "Missing cl_khr_select_fp_rounding_mode define" +#endif +#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable + +#endif + +// Core feature in CL 1.2 +#if (__OPENCL_C_VERSION__ < 120) +#ifndef cl_khr_fp64 +#error "Missing cl_khr_fp64 define" +#endif +#pragma OPENCL EXTENSION cl_khr_fp64: enable +#endif + +//Core feature in CL 2.0 +#if (__OPENCL_C_VERSION__ < 200) +#ifndef cl_khr_3d_image_writes +#error "Missing cl_khr_3d_image_writes define" +#endif +#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable +#endif + + +#if (__OPENCL_C_VERSION__ >= 110) +#ifndef cl_khr_gl_event +#error "Missing cl_khr_gl_event define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_gl_event: enable + +#if (__OPENCL_C_VERSION__ >= 110) +#ifndef cl_khr_d3d10_sharing +#error "Missing cl_khr_d3d10_sharing define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable + +#if (__OPENCL_C_VERSION__ >= 120) +#ifndef cl_khr_context_abort +#error "Missing cl_context_abort define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_context_abort: enable + +#if (__OPENCL_C_VERSION__ >= 120) +#ifndef cl_khr_d3d11_sharing +#error "Missing cl_khr_d3d11_sharing define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable + +#if (__OPENCL_C_VERSION__ >= 120) +#ifndef cl_khr_dx9_media_sharing +#error "Missing cl_khr_dx9_media_sharing define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable + +#if (__OPENCL_C_VERSION__ >= 120) +#ifndef cl_khr_image2d_from_buffer +#error "Missing cl_khr_image2d_from_buffer define" +#endif +#else +// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}} +#endif +#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable + +#if (__OPENCL_C_VE
[PATCH] D20737: clang-format: [JS] FormatToken.startsSequence/endsSequence.
mprobst created this revision. mprobst added a reviewer: djasper. mprobst added a subscriber: cfe-commits. Herald added a subscriber: klimek. Refactors AnnotatedLine.startsWith/endsWith by extracting the core functionality into FormatToken.startsSequence/endsSequence. This allows checking tokens within the pointered linked list structure with a lookahead, automatically ignoring comments, which is useful in many places (e.g. see subsequent commit). clang-format: [JS] fix async parsing. Only treat the sequence `async function` as the start of a function expression, as opposed to every occurrence of the token `async` (whoops). http://reviews.llvm.org/D20737 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.h lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp === --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -354,6 +354,10 @@ verifyFormat("class X {\n" " async asyncMethod() { return fetch(1); }\n" "}"); + verifyFormat("function initialize() {\n" + " // Comment.\n" + " return async.then();\n" + "}\n"); } TEST_F(FormatTestJS, ArrayLiterals) { Index: lib/Format/UnwrappedLineParser.cpp === --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -1013,7 +1013,9 @@ // Parse function literal unless 'function' is the first token in a line // in which case this should be treated as a free-standing function. if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) && + (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, + Keywords.kw_function)) && Line->Tokens.size() > 0) { tryToParseJSFunction(); break; @@ -1200,7 +1202,8 @@ } void UnwrappedLineParser::tryToParseJSFunction() { - assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)); + assert(FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)); if (FormatTok->is(Keywords.kw_async)) nextToken(); // Consume "function". @@ -1254,7 +1257,8 @@ // replace this by using parseAssigmentExpression() inside. do { if (Style.Language == FormatStyle::LK_JavaScript) { - if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) { + if (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) { tryToParseJSFunction(); continue; } @@ -1352,7 +1356,8 @@ break; case tok::identifier: if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) + (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function))) tryToParseJSFunction(); else nextToken(); Index: lib/Format/TokenAnnotator.h === --- lib/Format/TokenAnnotator.h +++ lib/Format/TokenAnnotator.h @@ -83,15 +83,15 @@ /// \c true if this line starts with the given tokens in order, ignoring /// comments. template bool startsWith(Ts... Tokens) const { -return startsWithInternal(First, Tokens...); +return First && First->startsSequence(Tokens...); } /// \c true if this line ends with the given tokens in reversed order, /// ignoring comments. /// For example, given tokens [T1, T2, T3, ...], the function returns true if /// this line is like "... T3 T2 T1". template bool endsWith(Ts... Tokens) const { -return endsWithInternal(Last, Tokens...); +return Last && Last->endsSequence(Tokens...); } /// \c true if this line looks like a function definition instead of a @@ -130,44 +130,6 @@ // Disallow copying. AnnotatedLine(const AnnotatedLine &) = delete; void operator=(const AnnotatedLine &) = delete; - - template - bool startsWithInternal(const FormatToken *Tok, A K1) const { -// Even though we skip comments in the outer `startWithInternal` function, -// this loop is still necessary if it is invoked by the public interface -// `startsWith`. -while (Tok && Tok->is(tok::comment)) - Tok = Tok->Next; -return Tok && Tok->is(K1); - } - - template - bool startsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const { -// Skip comments before calling `startsWithInternal(Tok, K1)` so that the -// second call to `startsWithInternal` takes the correct `Tok->Next`, which -// should be the next token of the token checked in the first call. -while (Tok && Tok
Re: [PATCH] D20737: clang-format: [JS] FormatToken.startsSequence/endsSequence.
mprobst updated this revision to Diff 58809. mprobst added a comment. - fix description http://reviews.llvm.org/D20737 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.h lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp === --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -354,6 +354,10 @@ verifyFormat("class X {\n" " async asyncMethod() { return fetch(1); }\n" "}"); + verifyFormat("function initialize() {\n" + " // Comment.\n" + " return async.then();\n" + "}\n"); } TEST_F(FormatTestJS, ArrayLiterals) { Index: lib/Format/UnwrappedLineParser.cpp === --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -1013,7 +1013,9 @@ // Parse function literal unless 'function' is the first token in a line // in which case this should be treated as a free-standing function. if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function) && + (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, + Keywords.kw_function)) && Line->Tokens.size() > 0) { tryToParseJSFunction(); break; @@ -1200,7 +1202,8 @@ } void UnwrappedLineParser::tryToParseJSFunction() { - assert(FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)); + assert(FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)); if (FormatTok->is(Keywords.kw_async)) nextToken(); // Consume "function". @@ -1254,7 +1257,8 @@ // replace this by using parseAssigmentExpression() inside. do { if (Style.Language == FormatStyle::LK_JavaScript) { - if (FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) { + if (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) { tryToParseJSFunction(); continue; } @@ -1352,7 +1356,8 @@ break; case tok::identifier: if (Style.Language == FormatStyle::LK_JavaScript && - FormatTok->isOneOf(Keywords.kw_async, Keywords.kw_function)) + (FormatTok->is(Keywords.kw_function) || + FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function))) tryToParseJSFunction(); else nextToken(); Index: lib/Format/TokenAnnotator.h === --- lib/Format/TokenAnnotator.h +++ lib/Format/TokenAnnotator.h @@ -83,15 +83,15 @@ /// \c true if this line starts with the given tokens in order, ignoring /// comments. template bool startsWith(Ts... Tokens) const { -return startsWithInternal(First, Tokens...); +return First && First->startsSequence(Tokens...); } /// \c true if this line ends with the given tokens in reversed order, /// ignoring comments. /// For example, given tokens [T1, T2, T3, ...], the function returns true if /// this line is like "... T3 T2 T1". template bool endsWith(Ts... Tokens) const { -return endsWithInternal(Last, Tokens...); +return Last && Last->endsSequence(Tokens...); } /// \c true if this line looks like a function definition instead of a @@ -130,44 +130,6 @@ // Disallow copying. AnnotatedLine(const AnnotatedLine &) = delete; void operator=(const AnnotatedLine &) = delete; - - template - bool startsWithInternal(const FormatToken *Tok, A K1) const { -// Even though we skip comments in the outer `startWithInternal` function, -// this loop is still necessary if it is invoked by the public interface -// `startsWith`. -while (Tok && Tok->is(tok::comment)) - Tok = Tok->Next; -return Tok && Tok->is(K1); - } - - template - bool startsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const { -// Skip comments before calling `startsWithInternal(Tok, K1)` so that the -// second call to `startsWithInternal` takes the correct `Tok->Next`, which -// should be the next token of the token checked in the first call. -while (Tok && Tok->is(tok::comment)) - Tok = Tok->Next; -return Tok && startsWithInternal(Tok, K1) && - startsWithInternal(Tok->Next, Tokens...); - } - - template - bool endsWithInternal(const FormatToken *Tok, A K1) const { -// See the comments above in `startsWithInternal(Tok, K1)`. -while (Tok && Tok->is(tok::comment)) - Tok = Tok->Previous; -return Tok && Tok->is(K1); - } - - template - bool endsWithInternal(const FormatToken *Tok, A K1, Ts... Tokens) const { -// See the comments above in `startsWithInter
Re: [PATCH] D20447: [OpenCL] Fixup extension list
arsenm added a subscriber: arsenm. Comment at: test/SemaOpenCL/extension-version.cl:12 @@ +11,3 @@ +#ifndef cl_clang_storage_class_specifiers +#error "Missing cl_clang_storage_class_specifiers define" +#endif When the AMD compiler added these warnings a long time ago I found them obnoxious and required adding more complicated ifdef combinations to silence them Repository: rL LLVM http://reviews.llvm.org/D20447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20715: [docs] Document the source-based code coverage feature
vsk updated this revision to Diff 58810. vsk marked 4 inline comments as done. vsk added a comment. Thanks for the feedback! - Addressed Sean's review comments. - Fixed the line count displayed in the summary view of `foo`. http://reviews.llvm.org/D20715 Files: docs/SourceBasedCodeCoverage.rst Index: docs/SourceBasedCodeCoverage.rst === --- /dev/null +++ docs/SourceBasedCodeCoverage.rst @@ -0,0 +1,187 @@ +== +Source-based Code Coverage +== + +.. contents:: + :local: + +Introduction + + +This document explains how to use clang's source-based code coverage feature. +It's called "source-based" because it operates on AST and preprocessor +information directly. This allows it to generate very precise coverage data. + +Clang ships two other code coverage implementations: + +* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the + various sanitizers. It can provide up to edge-level coverage. + +* gcov - A GCC-compatible coverage implementation which operates on DebugInfo. + +From this point onwards "code coverage" will refer to the source-based kind. + +The code coverage workflow +== + +The code coverage workflow consists of three main steps: + +1. Compiling with coverage enabled. + +2. Running the instrumented program. + +3. Creating coverage reports. + +The next few sections work through a complete, copy-'n-paste friendly example +based on this program: + +.. code-block:: console + +% cat < foo.cc +#define BAR(x) ((x) || (x)) +template void foo(T x) { + for (unsigned I = 0; I < 10; ++I) { BAR(I); } +} +int main() { + foo(0); + foo(0); + return 0; +} +EOF + +Compiling with coverage enabled +=== + +To compile code with coverage enabled pass ``-fprofile-instr-generate +-fcoverage-mapping`` to the compiler: + +.. code-block:: console + +# Step 1: Compile with coverage enabled. +% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo + +Note that linking together code with and without coverage instrumentation is +supported: any uninstrumented code simply won't be accounted for. + +Running the instrumented program + + +The next step is to run the instrumented program. When the program exits it +will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE`` +environment variable. If that variable does not exist the profile is written to +``./default.profraw``. + +If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the +missing directory structure will be created. Additionally, the following +special **pattern strings** are replaced: + +* "%p" expands out to the PID. + +* "%h" expands out to the hostname of the machine running the program. + +.. code-block:: console + +# Step 2: Run the program. +% LLVM_PROFILE_FILE="foo.profraw" ./foo + +Creating coverage reports += + +Raw profiles have to be **indexed** before they can be used to generated +coverage reports: + +.. code-block:: console + +# Step 3(a): Index the raw profile. +% llvm-profdata merge -sparse foo.profraw -o foo.profdata + +You may be wondering why raw profiles aren't indexed automatically. In +real-world projects multiple profiles have to be merged together before a +report can be generated. This merge step is inevitable, so it makes sense to +handle the compute-intensive indexing process at that point. A separate +indexing step has the added benefit of keeping the compiler runtime small and +simple. + +There are multiple different ways to render coverage reports. One option is to +generate a line-oriented report: + +.. code-block:: console + +# Step 3(b): Create a line-oriented coverage report. +% llvm-cov show ./foo -instr-profile=foo.profdata + +This report includes a summary view as well as dedicated sub-views for +templated functions and their instantiations. For our example program, we get +distinct views for ``foo(...)`` and ``foo(...)``. If +``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays nested +region counts (even in macro expansions): + +.. code-block:: console + + 20|1|#define BAR(x) ((x) || (x)) + ^20 ^2 +2|2|template void foo(T x) { + 22|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } + ^22 ^20 ^20^20 +2|4|} +-- +| _Z3fooIiEvT_: +| 1|2|template void foo(T x) { +| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +| ^11 ^10 ^10^10 +| 1|4|} +-- +| _Z3fooIfEvT_: +| 1|2|template void foo(T x) { +| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +|
Re: [PATCH] D20660: Remove `auto_ptr` in C++17.
ah, indeed :/ On Fri, May 27, 2016 at 10:55 AM, Eric Fiselier wrote: > > As for tests - XFAILing seems a bit general when there's really not > much value in running any of the tests anyway. REQUIRES, perhaps? > > Unfortunately REQUIRES is a conjunction so the obvious "// REQUIRES: > c++98, c++03, c++11, c++14" won't work. > > On Thu, May 26, 2016 at 11:32 AM, David Blaikie > wrote: > >> NO_REMOVE seems like a strange way of saying it - is there existing >> precedent for that naming/description? (rather than something like >> _LIBCPP_PROVIDE_AUTOPTR ? >> >> As for tests - XFAILing seems a bit general when there's really not much >> value in running any of the tests anyway. REQUIRES, perhaps? (that does >> bring the issue I assume Eric is alluding to forward a bit (I assume what >> he's alluding to is that when we have c++2x then we'd have to say XFAIL >> c++1z c++2x and so on - switching it around we /already/ have the problem >> that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) & >> maybe having an explicit test or two for the negative case (I would worry >> that XFAIL would be too vague "this should fail somehow... "). But maybe >> that's all unnecessary paranoia. >> >> - Dave >> >> On Wed, May 25, 2016 at 9:28 PM, Marshall Clow via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> mclow.lists created this revision. >>> mclow.lists added a reviewer: EricWF. >>> mclow.lists added a subscriber: cfe-commits. >>> >>> [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 | >>> N4190 ]] removed `auto_ptr` from C++1z. (and other stuff) >>> >>> Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling >>> with `-std=c++1z` or later. >>> >>> Introduce a new configuration option, `_LIBCPP_NO_REMOVE_AUTOPTR` which >>> allows user code to continue using `auto_ptr` in C++1z mode if desired. >>> >>> Add a test for `_LIBCPP_NO_REMOVE_AUTOPTR`, and mark all the rest of the >>> `auto_ptr` tests to XFAIL for c++1z >>> >>> http://reviews.llvm.org/D20660 >>> >>> Files: >>> include/memory >>> test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp >>> >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp >>> >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp >>> >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp >>> >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp >>> >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp >>> test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp >>> >>> >>> ___ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >>> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20660: Remove `auto_ptr` in C++17.
> As for tests - XFAILing seems a bit general when there's really not much value in running any of the tests anyway. REQUIRES, perhaps? Unfortunately REQUIRES is a conjunction so the obvious "// REQUIRES: c++98, c++03, c++11, c++14" won't work. On Thu, May 26, 2016 at 11:32 AM, David Blaikie wrote: > NO_REMOVE seems like a strange way of saying it - is there existing > precedent for that naming/description? (rather than something like > _LIBCPP_PROVIDE_AUTOPTR ? > > As for tests - XFAILing seems a bit general when there's really not much > value in running any of the tests anyway. REQUIRES, perhaps? (that does > bring the issue I assume Eric is alluding to forward a bit (I assume what > he's alluding to is that when we have c++2x then we'd have to say XFAIL > c++1z c++2x and so on - switching it around we /already/ have the problem > that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) & > maybe having an explicit test or two for the negative case (I would worry > that XFAIL would be too vague "this should fail somehow... "). But maybe > that's all unnecessary paranoia. > > - Dave > > On Wed, May 25, 2016 at 9:28 PM, Marshall Clow via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> mclow.lists created this revision. >> mclow.lists added a reviewer: EricWF. >> mclow.lists added a subscriber: cfe-commits. >> >> [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 | N4190 >> ]] removed `auto_ptr` from C++1z. (and other stuff) >> >> Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling >> with `-std=c++1z` or later. >> >> Introduce a new configuration option, `_LIBCPP_NO_REMOVE_AUTOPTR` which >> allows user code to continue using `auto_ptr` in C++1z mode if desired. >> >> Add a test for `_LIBCPP_NO_REMOVE_AUTOPTR`, and mark all the rest of the >> `auto_ptr` tests to XFAIL for c++1z >> >> http://reviews.llvm.org/D20660 >> >> Files: >> include/memory >> test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp >> >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp >> >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp >> >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp >> >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp >> >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp >> test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r271022 - [Headers] Remove redundant typedef. NFC.
Author: ab Date: Fri May 27 12:57:23 2016 New Revision: 271022 URL: http://llvm.org/viewvc/llvm-project?rev=271022&view=rev Log: [Headers] Remove redundant typedef. NFC. Modified: cfe/trunk/lib/Headers/smmintrin.h Modified: cfe/trunk/lib/Headers/smmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=271022&r1=271021&r2=271022&view=diff == --- cfe/trunk/lib/Headers/smmintrin.h (original) +++ cfe/trunk/lib/Headers/smmintrin.h Fri May 27 12:57:23 2016 @@ -299,7 +299,6 @@ _mm_cvtepi8_epi64(__m128i __V) { /* This function always performs a signed extension, but __v16qi is a char which may be signed or unsigned, so use __v16qs. */ - typedef signed char __v16qs __attribute__((__vector_size__(16))); return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1), __v2di); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types
pirama updated this revision to Diff 58813. pirama added a comment. Switched to emitting errors when rgba is used in OpenCL < 2.2. Also, fixed the diagnostic's name mismatch at its point of issue. http://reviews.llvm.org/D20602 Files: include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td lib/AST/Expr.cpp lib/Sema/SemaExprMember.cpp test/CodeGen/ext-vector.c test/Sema/ext_vector_components.c test/SemaOpenCL/ext_vectors.cl Index: test/SemaOpenCL/ext_vectors.cl === --- /dev/null +++ test/SemaOpenCL/ext_vectors.cl @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1 +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 + +typedef float float4 __attribute__((ext_vector_type(4))); + +void test_ext_vector_accessors(float4 V) { + V = V.wzyx; + V = V.abgr; // expected-error {{vector component name 'a' cannot be used earlier than OpenCL version 2.2}} + V = V.xyzr; // expected-error {{vector component name 'r' cannot be used earlier than OpenCL version 2.2}} \ + // expected-error {{illegal vector component name 'r'}} +} Index: test/Sema/ext_vector_components.c === --- test/Sema/ext_vector_components.c +++ test/Sema/ext_vector_components.c @@ -39,6 +39,33 @@ vec4.x = vec16.sF; vec4p->yz = vec4p->xy; + +vec2.a; // expected-error {{vector component access exceeds type 'float2'}} +vec2.rgba; // expected-error {{vector component access exceeds type 'float2'}} +vec4.rgba; // expected-warning {{expression result unused}} +vec4.rgbz; // expected-error {{illegal vector component name 'z'}} +vec4.rgbc; // expected-error {{illegal vector component name 'c'}} +vec4.xyzr; // expected-error {{illegal vector component name 'r'}} +vec4.s01b; // expected-error {{vector component access exceeds type 'float4'}} + +vec3 = vec4.rgb; // legal, shorten +f = vec2.r; // legal, shorten +f = vec4.rg.r; // legal, shorten +vec4_2.rgba = vec4.xyzw; // legal, no intermingling + +vec4_2.rgbr = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}} +vec4_2.rgbb = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}} +vec4_2.rgga = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}} +vec2.x = f; +vec2.rr = vec2_2.rg; // expected-error {{vector is not assignable (contains duplicate components)}} +vec2.gr = vec2_2.rg; +vec2.gr.g = vec2_2.r; +vec4 = (float4){ 1,2,3,4 }; +vec4.rg.b; // expected-error {{vector component access exceeds type 'float2'}} +vec4.r = vec16.sf; +vec4.g = vec16.sF; + +vec4p->gb = vec4p->rg; } float2 lo(float3 x) { return x.lo; } Index: test/CodeGen/ext-vector.c === --- test/CodeGen/ext-vector.c +++ test/CodeGen/ext-vector.c @@ -301,3 +301,40 @@ char valC; char16 destVal = valC ? valA : valB; } + +typedef __attribute__(( ext_vector_type(16) )) float float16; + +float16 vec16, vec16_2; + +// CHECK: @test_rgba +void test_rgba() { + // CHECK: fadd <4 x float> + vec4_2 = vec4.abgr + vec4; + + // CHECK: shufflevector {{.*}} + vec2 = vec4.rg; + // CHECK: shufflevector {{.*}} + vec2_2 = vec4.ba; + // CHECK: extractelement {{.*}} 2 + f = vec4.b; + // CHECK: shufflevector {{.*}} + vec4_2 = vec4_2.; + + // CHECK: insertelement {{.*}} 0 + vec2.r = f; + // CHECK: shufflevector {{.*}} + vec2.gr = vec2; + + // CHECK: extractelement {{.*}} 0 + f = vec4_2.rg.r; + // CHECK: shufflevector {{.*}} + // CHECK: shufflevector {{.*}} + // CHECK: shufflevector {{.*}} + vec4.rgb = vec4.bgr; + + // CHECK: extractelement {{.*}} 11 + // CHECK: insertelement {{.*}} 2 + vec4.b = vec16.sb; + // CHECK: shufflevector {{.*}} + vec4_2 = vec16.sabcd; +} Index: lib/Sema/SemaExprMember.cpp === --- lib/Sema/SemaExprMember.cpp +++ lib/Sema/SemaExprMember.cpp @@ -268,6 +268,20 @@ llvm_unreachable("unexpected instance member access kind"); } +/// Determine whether input char is from rgba component set. +static bool +IsRGBA(char c) { + switch (c) { + case 'r': + case 'g': + case 'b': + case 'a': +return true; + default: +return false; + } +} + /// Check an ext-vector component access expression. /// /// VK should be set in advance to the value kind of the base @@ -307,11 +321,25 @@ HalvingSwizzle = true; } else if (!HexSwizzle && (Idx = vecType->getPointAccessorIdx(*compStr)) != -1) { +bool HasRGBA = IsRGBA(*compStr); do { + // Ensure that xyzw and rgba components don't intermingle. + if (HasRGBA != IsRGBA(*compStr)) +break; if (HasIndex[Idx]) HasRepeated = true; HasIndex[Idx] = true;
Re: [PATCH] D20684: [X86][SSE] Replace VPMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (clang)
ab added a subscriber: ab. ab accepted this revision. ab added a reviewer: ab. ab added a comment. This revision is now accepted and ready to land. I'd add the unsigned typedefs with their signed counterparts; no reason not to. With that, LGTM. Repository: rL LLVM http://reviews.llvm.org/D20684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
mclow.lists added a comment. If you're really going to do this, you should probably empty out most of the routines in src/cxa_exception.cpp as well. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
EricWF added a comment. I have an issue with this change since it allows a libc++abi built without exceptions to be used in a program compiled with them. I assert that this should not be supported in any way. My personal preference would be to remove as much of the exception API from the library when it's built without exceptions. This should cause link errors if a program contains any code that throws. If this is not done it creates bugs within code like `__terminate` as mentioned in an inline comment. I would like to see another revision of this patch that removes as much of the exception API as possible. Looking at the symbols defined in `cxxabi.h` I would say ever symbol in sections 2.4 and 2.5 should not longer be defined in the library. Comment at: src/cxa_handlers.cpp:62 @@ -61,3 +61,3 @@ void __terminate(terminate_handler func) _NOEXCEPT { If any part of your executable was compiled with exceptions on, and it sets a terminate handler that throws an exception this does the wrong thing. I don't really like that although I admit that would certainly be an exceptional situation. At minimum this requirement needs to be documented explicitly somewhere. Within the CMake option description seems fine for now. Comment at: src/cxa_personality.cpp:1204 @@ -1203,2 +1203,3 @@ } +#ifndef _LIBCXXABI_NO_EXCEPTIONS try This is yucky. We are in exception handling code and we are saying it has been built without exceptions. I understand this "gets libc++abi to compile" without exceptions but it doesn't really make sense. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20744: [OpenCL] Disable warning about core features by default
jvesely created this revision. jvesely added reviewers: Anastasia, yaxunl. jvesely added subscribers: cfe-commits, arsenm. jvesely set the repository for this revision to rL LLVM. Repository: rL LLVM http://reviews.llvm.org/D20744 Files: include/clang/Basic/DiagnosticParseKinds.td test/SemaOpenCL/extension-version.cl Index: test/SemaOpenCL/extension-version.cl === --- test/SemaOpenCL/extension-version.cl +++ test/SemaOpenCL/extension-version.cl @@ -2,8 +2,12 @@ // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES +// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -#if __OPENCL_C_VERSION__ >= 200 +#if __OPENCL_C_VERSION__ >= 200 && ! defined TEST_CORE_FEATURES // expected-no-diagnostics #endif @@ -38,57 +42,76 @@ #endif #pragma OPENCL EXTENSION cl_khr_icd: enable -// COre features in CL 1.1 -#if (__OPENCL_C_VERSION__ < 110) +// Core features in CL 1.1 #ifndef cl_khr_byte_addressable_store #error "Missing cl_khr_byte_addressable_store define" #endif #pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable +#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}} +#endif #ifndef cl_khr_global_int32_base_atomics #error "Missing cl_khr_global_int32_base_atomics define" #endif #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable +#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}} +#endif #ifndef cl_khr_global_int32_extended_atomics #error "Missing cl_khr_global_int32_extended_atomics define" #endif #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable +#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} +#endif #ifndef cl_khr_local_int32_base_atomics #error "Missing cl_khr_local_int32_base_atomics define" #endif #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable +#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}} +#endif #ifndef cl_khr_local_int32_extended_atomics #error "Missing cl_khr_local_int32_extended_atomics define" #endif #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable +#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}} +#endif +#if (__OPENCL_C_VERSION__ < 110) +// Deprecated abvoe 1.0 #ifndef cl_khr_select_fprounding_mode #error "Missing cl_khr_select_fp_rounding_mode define" #endif #pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable - #endif + // Core feature in CL 1.2 -#if (__OPENCL_C_VERSION__ < 120) #ifndef cl_khr_fp64 #error "Missing cl_khr_fp64 define" #endif #pragma OPENCL EXTENSION cl_khr_fp64: enable +#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} #endif //Core feature in CL 2.0 -#if (__OPENCL_C_VERSION__ < 200) #ifndef cl_khr_3d_image_writes #error "Missing cl_khr_3d_image_writes define" #endif #pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable +#if (__OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES +// expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}} #endif + #if (__OPENCL_C_VERSION__ >= 110) #ifndef cl_khr_gl_event #error "Missing cl_khr_gl_event define" Index: include/clang/Basic/DiagnosticParseKinds.td === --- include/clang/Basic/DiagnosticParseKinds.td +++ include/clang/Basic/DiagnosticParseKinds.td @@ -929,7 +929,7 @@ def warn_pragma_unsupported_extension : Warning< "unsupported OpenCL extension %0 - i
Re: [PATCH] D20447: [OpenCL] Fixup extension list
jvesely marked 7 inline comments as done. Comment at: test/SemaOpenCL/extension-version.cl:12 @@ +11,3 @@ +#ifndef cl_clang_storage_class_specifiers +#error "Missing cl_clang_storage_class_specifiers define" +#endif arsenm wrote: > When the AMD compiler added these warnings a long time ago I found them > obnoxious and required adding more complicated ifdef combinations to silence > them moved to D20744 Repository: rL LLVM http://reviews.llvm.org/D20447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Missing definition of a template virtual function
Hi, I want to discuss the issue in PR27895, https://llvm.org/bugs/show_bug.cgi?id=27895 But I will give a slightly different example for this discussion. The issue can be demonstrated by this standalone code. Should this example link successfully? -- template < typename T, int N = 0 > class TmplWithArray { public: virtual T& operator [] (int idx); T ar[N+1]; }; template T& TmplWithArray::operator[](int idx) { return ar[idx]; } class Wrapper { TmplWithArray data; bool indexIt(int a); }; bool Wrapper::indexIt(int a) { return data[a]; } int main(){} -- Starting from r227073 it does not link (at any optimization level). The code has a direct call to the operator[] function, but that function definition is not generated. Versions prior to r227073, - at -O0 or -O1, generate the operator[] function and the direct call, and - at -O2 do not generate the function, but inline it Either way they link fine. In this example the key-function for the generation of the vtable is the operator[] function itself. So the compiler can either generate both the vtable and the operator[] function, or not generate either; they are both consistent states. The call in data[a] is to a virtual function, and if the compiler left it as a virtual call, it will link. There will be no ctor, no vtable, and no operator[] function. Wrapper::indexIt will be dead code, but it will link. But the compiler does devirtualization of the call and generates a direct call, yet, beginning with r227073, it does not generate the operator[] function. Hence the link failure. Another interesting tidbit is that if the operator[] is replaced by a plain function doing the same thing, along with the corresponding change in the usage, something like: virtual T& getElt(int idx); then the behavior is the same as pre r227073. Either getElt is defined or it gets inlined. BTW, this is not just an idle curiosity. This example was trimmed down from a user bug report having a link failure. Sunil Srivastava Sony Interactive Entertainment ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
eric_niebler updated this revision to Diff 58828. eric_niebler added a comment. Add fixit tests, fix path separator fixit issue on Windows. http://reviews.llvm.org/D19843 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticLexKinds.td include/clang/Basic/FileManager.h include/clang/Basic/VirtualFileSystem.h include/clang/Lex/DirectoryLookup.h include/clang/Lex/HeaderSearch.h lib/Basic/FileManager.cpp lib/Basic/VirtualFileSystem.cpp lib/Lex/HeaderSearch.cpp lib/Lex/PPDirectives.cpp test/Lexer/Inputs/case-insensitive-include.h test/Lexer/case-insensitive-include-ms.c test/Lexer/case-insensitive-include.c test/PCH/case-insensitive-include.c Index: test/PCH/case-insensitive-include.c === --- test/PCH/case-insensitive-include.c +++ test/PCH/case-insensitive-include.c @@ -2,7 +2,7 @@ // Test this without pch. // RUN: cp %S/Inputs/case-insensitive-include.h %T -// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify +// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T Index: test/Lexer/case-insensitive-include.c === --- /dev/null +++ test/Lexer/case-insensitive-include.c @@ -0,0 +1,27 @@ +// REQUIRES: case-insensitive-filesystem + +// RUN: mkdir -p %T/apath +// RUN: cp %S/Inputs/case-insensitive-include.h %T +// RUN: cd %T +// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s + +#include "case-insensitive-include.h" +#include "Case-Insensitive-Include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\"" + +#include "../Output/./case-insensitive-include.h" +#include "../Output/./Case-Insensitive-Include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\"" +#include "../output/./case-insensitive-include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\"" + +#include "apath/.././case-insensitive-include.h" +#include "apath/.././Case-Insensitive-Include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath/.././case-insensitive-include.h\"" +#include "APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-( + +#include "../Output/./apath/.././case-insensitive-include.h" +#include "../Output/./APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-( +#include "../output/./apath/.././case-insensitive-include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:61}:"\"../Output/./apath/.././case-insensitive-include.h\"" Index: test/Lexer/case-insensitive-include-ms.c === --- /dev/null +++ test/Lexer/case-insensitive-include-ms.c @@ -0,0 +1,18 @@ +// REQUIRES: case-insensitive-filesystem + +// RUN: mkdir -p %T/apath +// RUN: cp %S/Inputs/case-insensitive-include.h %T +// RUN: cd %T +// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %T -verify +// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s + +#include "..\Output\.\case-insensitive-include.h" +#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\"" +#include "..\output\.\case-insensitive-include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\"" + +#include "apath\..\.\case-insensitive-include.h" +#include "apath\..\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}} +// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath\\..\\.\\case-insensitive-include.h\"" +#include "APath\..\.\case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-( Index: test/Lexer/Inputs/case-insensitive-include.h === --- /dev/null +++ test/Lexer/Inputs/case-insensitive-include.h @@ -0,0 +1,5 @@ +#pragma once + +struct S { + int x; +}; Index: lib/Lex/PPDirectives.cpp === --- lib/Lex/PPDirectives.cpp +++ lib/Lex/PPDirectives.cpp @@ -24,6 +24,9 @@ #include "clang/Lex/ModuleLoader.h" #include "clang/Lex/Pragma.h" #include "llvm/ADT/A
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
ahatanak added a comment. Thanks! Marshall, I've filed a PR for this bug: https://llvm.org/bugs/show_bug.cgi?id=27915 http://reviews.llvm.org/D20334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module
yaxunl retitled this revision from "[OpenCL] Include opencl-c.h by default as a module" to "[OpenCL] Include opencl-c.h by default as a clang module". yaxunl updated the summary for this revision. yaxunl updated this revision to Diff 58830. yaxunl added a comment. Revised as Anastasia suggested. Add option -finclude-default-header to include OpenCL default header file, which is off by default. Add test to make sure the AST of the header is really cached and works for different OpenCL versions. http://reviews.llvm.org/D20444 Files: include/clang/Basic/LangOptions.def include/clang/Driver/CC1Options.td include/clang/Frontend/CompilerInvocation.h lib/Frontend/CompilerInvocation.cpp lib/Headers/module.modulemap test/Headers/opencl-c-header.cl Index: test/Headers/opencl-c-header.cl === --- test/Headers/opencl-c-header.cl +++ test/Headers/opencl-c-header.cl @@ -1,9 +1,61 @@ // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s // RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s -// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s +// RUN: %clang_cc1 -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s +// RUN: %clang_cc1 -emit-llvm -verify -DNO_HEADER %s +// RUN: %clang_cc1 -finclude-default-header -emit-llvm -o - %s | FileCheck %s // CHECK: _Z16convert_char_rtec +// CHECK20: _Z3ctzc + +// Test including the default header as a module. +// The module should be compiled only once and loaded from cache afterwards. + +// === +// Clear current directory. +// RUN: rm -rf %t +// RUN: mkdir -p %t + +// === +// Compile for OpenCL 1.0 for the first time. A module should be generated. +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s +// RUN: cp %t/opencl_c.pcm %t/1_0.pcm + +// === +// Compile for OpenCL 1.0 for the second time. The module should not change. +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s +// RUN: diff %t/1_0.pcm %t/opencl_c.pcm +// RUN: rm %t/opencl_c.pcm + +// === +// Compile for OpenCL 2.0 for the first time. The module should change. +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck --check-prefix=CHECK20 %s +// RUN: not diff %t/1_0.pcm %t/opencl_c.pcm +// RUN: cp %t/opencl_c.pcm %t/2_0.pcm + +// === +// Compile for OpenCL 2.0 for the second time. The module should not change. +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck --check-prefix=CHECK20 %s +// RUN: diff %t/2_0.pcm %t/opencl_c.pcm + +// Check cached module works for different OpenCL versions. +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck %s +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -triple amdgcn--amdhsa -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck %s +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s +// RUN: %clang_cc1 -cc1 -emit-llvm -o - -cl-std=CL2.0 -triple amdgcn--amdhsa -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s + char f(char x) { +#if __OPENCL_C_VERSION__ != CL_VERSION_2_0 return convert_char_rte(x); +#ifdef NO_HEADER + //expected-warning@-2{{implicit declaration of function 'convert_char_rte' is invalid in C99}} +#endif //NO_HEADER + +#else //__OPENCL_C_VERSION__ + return ctz(x); +#endif //__OPENCL_C_VERSION__ } Index: lib/Headers/module.modulemap === --- lib/Headers/module.modulemap +++ lib/Headers/module.modulemap @@ -157,3 +157,8 @@ module _Builtin_stddef_max_align_t [syst
Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module
yaxunl marked an inline comment as done. Comment at: include/clang/Basic/LangOptions.def:220 @@ -219,3 +219,3 @@ ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, "OpenCL address space map mangling mode") - +LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL") BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing") I agree and has made the change. The module caches AST of the header file, which is essentially the same thing as PCH. I checked a typical OpenCL progam. Without including header, ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0211 (100.0%) Clang front-end timer 0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0211 (100.0%) Total With header but without module caching, ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.2160 (100.0%) 0.0120 (100.0%) 0.2280 (100.0%) 0.2271 (100.0%) Clang front-end timer 0.2160 (100.0%) 0.0120 (100.0%) 0.2280 (100.0%) 0.2271 (100.0%) Total With header and module caching, ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0222 ( 93.6%) Clang front-end timer 0. ( 0.0%) 0. ( 0.0%) 0. ( 0.0%) 0.0008 ( 3.5%) Reading modules 0. ( 0.0%) 0. ( 0.0%) 0. ( 0.0%) 0.0007 ( 2.9%) Loading /home/yaxunl/llvm-tot/llvm/tools/clang/test/CodeGenOpenCL/./JJHF9CF78G8Z/opencl_c-3RXFI66A6CUM7.pcm 0.0160 (100.0%) 0.0080 (100.0%) 0.0240 (100.0%) 0.0237 (100.0%) Total So the caching is very effective and essentially makes the header loading time to be ignored. http://reviews.llvm.org/D20444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20748: Handle recursion in LLVMIRGeneration Timer
davide created this revision. davide added reviewers: rafael, vsk. davide added a subscriber: cfe-commits. See http://reviews.llvm.org/D20735 for more context. Implementing this clang-side is not as terrible as I originally thought. Maybe needs a test case, but I wasn't able to reduce one easily (yet). http://reviews.llvm.org/D20748 Files: clang/lib/CodeGen/CodeGenAction.cpp Index: clang/lib/CodeGen/CodeGenAction.cpp === --- clang/lib/CodeGen/CodeGenAction.cpp +++ clang/lib/CodeGen/CodeGenAction.cpp @@ -50,6 +50,7 @@ ASTContext *Context; Timer LLVMIRGeneration; +unsigned LLVMIRGenerationRefCount; std::unique_ptr Gen; @@ -73,6 +74,7 @@ : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts), TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS), Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"), + LLVMIRGenerationRefCount(0), Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts, CodeGenOpts, C, CoverageInfo)) { llvm::TimePassesIsEnabled = TimePasses; @@ -112,13 +114,20 @@ Context->getSourceManager(), "LLVM IR generation of declaration"); - if (llvm::TimePassesIsEnabled) -LLVMIRGeneration.startTimer(); + // Recurse. + if (llvm::TimePassesIsEnabled) { +LLVMIRGenerationRefCount += 1; +if (LLVMIRGenerationRefCount == 1) + LLVMIRGeneration.startTimer(); + } Gen->HandleTopLevelDecl(D); - if (llvm::TimePassesIsEnabled) -LLVMIRGeneration.stopTimer(); + if (llvm::TimePassesIsEnabled) { +LLVMIRGenerationRefCount -= 1; +if (LLVMIRGenerationRefCount == 0) + LLVMIRGeneration.stopTimer(); + } return true; } @@ -139,13 +148,19 @@ void HandleTranslationUnit(ASTContext &C) override { { PrettyStackTraceString CrashInfo("Per-file LLVM IR generation"); -if (llvm::TimePassesIsEnabled) - LLVMIRGeneration.startTimer(); +if (llvm::TimePassesIsEnabled) { + LLVMIRGenerationRefCount += 1; + if (LLVMIRGenerationRefCount == 1) +LLVMIRGeneration.startTimer(); +} Gen->HandleTranslationUnit(C); -if (llvm::TimePassesIsEnabled) - LLVMIRGeneration.stopTimer(); +if (llvm::TimePassesIsEnabled) { + LLVMIRGenerationRefCount -= 1; + if (LLVMIRGenerationRefCount == 0) +LLVMIRGeneration.stopTimer(); +} } // Silently ignore if we weren't initialized for some reason. Index: clang/lib/CodeGen/CodeGenAction.cpp === --- clang/lib/CodeGen/CodeGenAction.cpp +++ clang/lib/CodeGen/CodeGenAction.cpp @@ -50,6 +50,7 @@ ASTContext *Context; Timer LLVMIRGeneration; +unsigned LLVMIRGenerationRefCount; std::unique_ptr Gen; @@ -73,6 +74,7 @@ : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts), TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS), Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"), + LLVMIRGenerationRefCount(0), Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts, CodeGenOpts, C, CoverageInfo)) { llvm::TimePassesIsEnabled = TimePasses; @@ -112,13 +114,20 @@ Context->getSourceManager(), "LLVM IR generation of declaration"); - if (llvm::TimePassesIsEnabled) -LLVMIRGeneration.startTimer(); + // Recurse. + if (llvm::TimePassesIsEnabled) { +LLVMIRGenerationRefCount += 1; +if (LLVMIRGenerationRefCount == 1) + LLVMIRGeneration.startTimer(); + } Gen->HandleTopLevelDecl(D); - if (llvm::TimePassesIsEnabled) -LLVMIRGeneration.stopTimer(); + if (llvm::TimePassesIsEnabled) { +LLVMIRGenerationRefCount -= 1; +if (LLVMIRGenerationRefCount == 0) + LLVMIRGeneration.stopTimer(); + } return true; } @@ -139,13 +148,19 @@ void HandleTranslationUnit(ASTContext &C) override { { PrettyStackTraceString CrashInfo("Per-file LLVM IR generation"); -if (llvm::TimePassesIsEnabled) - LLVMIRGeneration.startTimer(); +if (llvm::TimePassesIsEnabled) { + LLVMIRGenerationRefCount += 1; + if (LLVMIRGenerationRefCount == 1) +LLVMIRGeneration.startTimer(); +} Gen->HandleTranslationUnit(C); -if (llvm::TimePassesIsEnabled) - LLVMIRGeneration.stopTimer(); +if (llvm::TimePassesIsEnabled) { + LLVMIRGenerationRefCount -= 1; + if (LLVMIRGenerationRefCount == 0) +LLVMIRG
r271042 - [Driver] Fix driver support for color diagnostics
Author: bruno Date: Fri May 27 15:43:00 2016 New Revision: 271042 URL: http://llvm.org/viewvc/llvm-project?rev=271042&view=rev Log: [Driver] Fix driver support for color diagnostics Diagnostics that happen during driver time do not have color output support unless -fcolor-diagonostic is explicitly passed into the driver. This is not a problem for cc1 since dianostic arguments are properly handled and color is enabled by default if the terminal supports it. Make the driver behave like CC1. There are tests that already check for these flags, but for the color itself there's no sensible way to test it. Differential Revision: http://reviews.llvm.org/D20404 rdar://problem/26290980 Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=271042&r1=271041&r2=271042&view=diff == --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original) +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Fri May 27 15:43:00 2016 @@ -47,7 +47,8 @@ class DiagnosticsEngine; /// When errors are encountered, return false and, if Diags is non-null, /// report the error(s). bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, - DiagnosticsEngine *Diags = nullptr); + DiagnosticsEngine *Diags = nullptr, + bool DefaultDiagColor = true); class CompilerInvocationBase : public RefCountedBase { void operator=(const CompilerInvocationBase &) = delete; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=271042&r1=271041&r2=271042&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 27 15:43:00 2016 @@ -5589,43 +5589,27 @@ void Clang::ConstructJob(Compilation &C, CmdArgs.push_back("-fno-diagnostics-show-note-include-stack"); } - // Color diagnostics are the default, unless the terminal doesn't support - // them. - // Support both clang's -f[no-]color-diagnostics and gcc's - // -f[no-]diagnostics-colors[=never|always|auto]. - enum { Colors_On, Colors_Off, Colors_Auto } ShowColors = Colors_Auto; - for (const auto &Arg : Args) { -const Option &O = Arg->getOption(); + // Color diagnostics are parsed by the driver directly from argv + // and later re-parsed to construct this job; claim any possible + // color diagnostic here to avoid warn_drv_unused_argument and + // diagnose bad OPT_fdiagnostics_color_EQ values. + for (Arg *A : Args) { +const Option &O = A->getOption(); if (!O.matches(options::OPT_fcolor_diagnostics) && !O.matches(options::OPT_fdiagnostics_color) && !O.matches(options::OPT_fno_color_diagnostics) && !O.matches(options::OPT_fno_diagnostics_color) && !O.matches(options::OPT_fdiagnostics_color_EQ)) continue; - -Arg->claim(); -if (O.matches(options::OPT_fcolor_diagnostics) || -O.matches(options::OPT_fdiagnostics_color)) { - ShowColors = Colors_On; -} else if (O.matches(options::OPT_fno_color_diagnostics) || - O.matches(options::OPT_fno_diagnostics_color)) { - ShowColors = Colors_Off; -} else { - assert(O.matches(options::OPT_fdiagnostics_color_EQ)); - StringRef value(Arg->getValue()); - if (value == "always") -ShowColors = Colors_On; - else if (value == "never") -ShowColors = Colors_Off; - else if (value == "auto") -ShowColors = Colors_Auto; - else +if (O.matches(options::OPT_fdiagnostics_color_EQ)) { + StringRef Value(A->getValue()); + if (Value != "always" && Value != "never" && Value != "auto") getToolChain().getDriver().Diag(diag::err_drv_clang_unsupported) -<< ("-fdiagnostics-color=" + value).str(); + << ("-fdiagnostics-color=" + Value).str(); } +A->claim(); } - if (ShowColors == Colors_On || - (ShowColors == Colors_Auto && llvm::sys::Process::StandardErrHasColors())) + if (D.getDiags().getDiagnosticOptions().ShowColors) CmdArgs.push_back("-fcolor-diagnostics"); if (Args.hasArg(options::OPT_fansi_escape_codes)) Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=271042&r1=271041&r2=271042&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 27 15:43:00 2016 @@ -860,8 +860,51 @@ static void
[PATCH] D20749: Introduce support for relative C++ ABI gated on LTO visibility.
pcc created this revision. pcc added reviewers: rsmith, rjmccall, rafael, mehdi_amini, aaron.ballman, majnemer, rnk. pcc added a subscriber: cfe-commits. Herald added a subscriber: mehdi_amini. I'd like to propose this patch as an alternative to D17893 and D18199 that approaches the user interface to the relative C++ ABI feature from a different angle. Instead of adding custom attributes and a whitelist, we instead introduce a flag, -flto-relative-c++-abi-vtables, which enables the relative ABI only for classes with hidden LTO visibility [0], which is a concept we introduced for whole-program devirtualization that is based on object file visibility. That concept also effectively controls where the compiler is allowed to change the ABI arbitrarily. By using that very similar concept, we can start off with a much simpler overall user interface, at least for programs that are already using LTO. It may seem strange to tie this feature to LTO visibility (and LTO), since the feature of course does not intrinsically rely on LTO. However, I think it seems reasonable for hidden LTO visibility to act as one possible source of information for where the new ABI can be applied. At a later point we can consider introducing other ways to enable the ABI (such as specific attributes or whitelisting as proposed in D17893). By requiring classes to have hidden visibility (a prerequisite for hidden LTO visibility), we also avoid being blocked on the issues around non-hidden visibility in ELF that were raised on the initial discussion thread for this feature [1]. LTO also makes it a little easier to detect ABI mismatches in a platform independent way using module flags. This patch introduces a module flag that is used for that purpose. [0] http://clang.llvm.org/docs/LTOVisibility.html [1] http://lists.llvm.org/pipermail/llvm-dev/2016-February/096146.html http://reviews.llvm.org/D20749 Files: docs/UsersManual.rst include/clang/AST/DeclCXX.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/LangOptions.def include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def include/clang/Sema/Sema.h lib/AST/DeclCXX.cpp lib/CodeGen/CGClass.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGVTables.cpp lib/CodeGen/CGVTables.h lib/CodeGen/CodeGenFunction.h lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h lib/CodeGen/ItaniumCXXABI.cpp lib/CodeGen/MicrosoftCXXABI.cpp lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/bitsets.cpp test/CodeGenCXX/debug-info-virtual-fn-relative.cpp test/CodeGenCXX/vtable-relative-abi.cpp test/Driver/unstable-cxx-abi-vtables.cpp test/SemaCXX/unstable-cxx-abi.cpp Index: test/SemaCXX/unstable-cxx-abi.cpp === --- /dev/null +++ test/SemaCXX/unstable-cxx-abi.cpp @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 %s -w -std=c++11 -fsyntax-only -verify -flto-relative-c++-abi-vtables -fvisibility hidden + +struct __attribute__((visibility("default"))) platform { // expected-note 2{{base 'platform' uses the platform ABI}} + virtual void f(); +}; +struct relative { // expected-note 2{{base 'relative' uses the relative ABI}} + virtual void f(); +}; + +struct mixed_bases : platform, relative {}; // expected-error {{inconsistent ABI for class 'mixed_bases'}} +struct mixed_base_vbase : platform, virtual relative {}; // expected-error {{inconsistent ABI for class 'mixed_base_vbase'}} + +void f() { + struct relative2 { +virtual void f(); + }; + struct relative_derived : relative, relative2 {}; +} + +struct __attribute__((visibility("default"))) platform2 { + void mf() { +struct platform3 { + virtual void f(); +}; +struct platform_derived : platform, platform3 {}; + } +}; + +struct __attribute__((visibility("default"))) non_dynamic {}; + +struct relative_derived : non_dynamic, relative {}; +struct platform_derived : non_dynamic, platform {}; + +struct relative_derived2 : relative_derived, relative {}; +struct platform_derived2 : platform_derived, platform {}; Index: test/Driver/unstable-cxx-abi-vtables.cpp === --- /dev/null +++ test/Driver/unstable-cxx-abi-vtables.cpp @@ -0,0 +1,5 @@ +// RUN: %clang -flto-relative-c++-abi-vtables -### %s 2>&1 | FileCheck -check-prefix=CLASSES %s +// CLASSES: '-fwhole-program-vtables' only allowed with '-flto' +// +// RUN: %clang -flto -flto-relative-c++-abi-vtables -### %s 2>&1 | FileCheck -check-prefix=LTO-CLASSES %s +// LTO-CLASSES: "-flto-relative-c++-abi-vtables" Index: test/CodeGenCXX/vtable-relative-abi.cpp === --- /dev/null +++ test/CodeGenCXX/vtable-relative-abi.cpp @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 %s -flto -triple x86_64-unknown-linux-gnu -fvisibility hidden -flto-relative-c++-abi-vtables -emit-llvm -o - | FileCheck --check-prefix=CHECK --check-pr
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. In http://reviews.llvm.org/D20677#442559, @EricWF wrote: > I have an issue with this change since it allows a libc++abi built without > exceptions to be used in a program compiled with them. I assert that this > should not be supported in any way. > > My personal preference would be to remove as much of the exception API from > the library when it's built without exceptions. This should cause link errors > if a program contains any code that throws. If this is not done it creates > bugs within code like `__terminate` as mentioned in an inline comment. > > I would like to see another revision of this patch that removes as much of > the exception API as possible. Looking at the symbols defined in `cxxabi.h` I > would say ever symbol in sections 2.4 and 2.5 should not longer be defined in > the library. That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 6) has an elaborate mechanism (based on build attributes) to select the correct variant of libraries. In other words, if any of your objects are compiled with exceptions, you are guaranteed to no select any of the no-exceptions library variants. This avoids the problem you mentioned altogether. But I can see that this can be a problem for any other toolchain that does not have such a functionality, and a link-time error would be more suitable. I'll re-spin a patch soon. Thanks. / Asiri http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20744: [OpenCL] Disable warning about core features by default
yaxunl accepted this revision. yaxunl added a comment. This revision is now accepted and ready to land. LGTM Repository: rL LLVM http://reviews.llvm.org/D20744 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20684: [X86][SSE] Replace VPMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (clang)
RKSimon added a comment. In http://reviews.llvm.org/D20684#442514, @ab wrote: > I'd add the unsigned typedefs with their signed counterparts; no reason not > to. > With that, LGTM. Thanks, I'll do that as a follow up commit. Repository: rL LLVM http://reviews.llvm.org/D20684 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
EricWF added a comment. In http://reviews.llvm.org/D20677#442687, @rmaprath wrote: > In http://reviews.llvm.org/D20677#442559, @EricWF wrote: > > > I have an issue with this change since it allows a libc++abi built without > > exceptions to be used in a program compiled with them. I assert that this > > should not be supported in any way. > > > > My personal preference would be to remove as much of the exception API from > > the library when it's built without exceptions. This should cause link > > errors if a program contains any code that throws. If this is not done it > > creates bugs within code like `__terminate` as mentioned in an inline > > comment. > > > > I would like to see another revision of this patch that removes as much of > > the exception API as possible. Looking at the symbols defined in `cxxabi.h` > > I would say ever symbol in sections 2.4 and 2.5 should not longer be > > defined in the library. > > > That sounds generally OK to me. The toolchain I'm working on (ARM Compiler 6) > has an elaborate mechanism (based on build attributes) to select the correct > variant of libraries. In other words, if any of your objects are compiled > with exceptions, you are guaranteed to no select any of the no-exceptions > library variants. This avoids the problem you mentioned altogether. Note that that behavior will cause different issues in some cases. If you link an executable to two libraries, `libfoo.so` and `libbar.so`, where one was compiled with exceptions and the other without you'll get two copies of libc++abi in the program. Now you have two copies of the global terminate handler and two copies of `__terminate` for the linker to select from. If it selects the nothrow `__terminate` and the terminate handler throws an exception your in trouble. That's not a reason to hold up this patch, but it is a potential problem you should be aware of. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer
vsk added a comment. Comments on this patch -- The increment and decrement snippets seem like they could be pulled into helper methods. That should make it easier to update all users of LLVMIRGeneration. I wasn't able to come up with a regression test, but I do think this patch needs one. Overall comments -- My main concern is that this isn't the only affected user of the Timer class. I have a preference for http://reviews.llvm.org/D20735 because it defines the underlying problem away. I'll defer to someone else on this (maybe @rafael?). http://reviews.llvm.org/D20748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. In http://reviews.llvm.org/D20677#442713, @EricWF wrote: > In http://reviews.llvm.org/D20677#442687, @rmaprath wrote: > > > In http://reviews.llvm.org/D20677#442559, @EricWF wrote: > > > > > I have an issue with this change since it allows a libc++abi built > > > without exceptions to be used in a program compiled with them. I assert > > > that this should not be supported in any way. > > > > > > My personal preference would be to remove as much of the exception API > > > from the library when it's built without exceptions. This should cause > > > link errors if a program contains any code that throws. If this is not > > > done it creates bugs within code like `__terminate` as mentioned in an > > > inline comment. > > > > > > I would like to see another revision of this patch that removes as much > > > of the exception API as possible. Looking at the symbols defined in > > > `cxxabi.h` I would say ever symbol in sections 2.4 and 2.5 should not > > > longer be defined in the library. > > > > > > That sounds generally OK to me. The toolchain I'm working on (ARM Compiler > > 6) has an elaborate mechanism (based on build attributes) to select the > > correct variant of libraries. In other words, if any of your objects are > > compiled with exceptions, you are guaranteed to no select any of the > > no-exceptions library variants. This avoids the problem you mentioned > > altogether. > > > Note that that behavior will cause different issues in some cases. If you > link an executable to two libraries, `libfoo.so` and `libbar.so`, where one > was compiled with exceptions and the other without you'll get two copies of > libc++abi in the program. Now you have two copies of the global terminate > handler and two copies of `__terminate` for the linker to select from. > If it selects the nothrow `__terminate` and the terminate handler throws an > exception your in trouble. In this case, I expect the linker to only select one variant of libc++abi (the one with exceptions). The idea behind build-attributes is to capture user intentions, if the user links his program with `libbar.a` and `libfoo.a` user libraries (with and without exceptions), the linker would assume that the user meant to use exceptions rather than not, and hence select the with-exceptions libc++abi variant. The theory behind build-attributes is bit more complicated that that though, I'm not the best person to go on about this. In any case, I agree that getting the linker to produce an error (when linking with-exceptions objects with a no-exceptions libc++abi) is much more clearer. I have a small concern about how difficult this would make things for us though - our toolchain setup uses `-ffunction-sections` and `-fdata-sections` along with linker's unused-section elimination to get rid of most of the stuff not necessary for the final image, but I can't remember if unused-section elimination happens before or after checking for missing symbols. If it is the latter, then we might be in trouble with this approach. I will have a look into this when I get back to work. Cheers, / Asiri http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer
On 27 May 2016 at 17:32, Vedant Kumar wrote: > vsk added a comment. > > Comments on this patch -- The increment and decrement snippets seem like they > could be pulled into helper methods. That should make it easier to update all > users of LLVMIRGeneration. I wasn't able to come up with a regression test, > but I do think this patch needs one. > > Overall comments -- My main concern is that this isn't the only affected user > of the Timer class. I have a preference for http://reviews.llvm.org/D20735 > because it defines the underlying problem away. I'll defer to someone else on > this (maybe @rafael?). What is the other recursive use? Cheers, Rafael ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. > I have a small concern about how difficult this would make things for us > though - our toolchain setup uses `-ffunction-sections` and `-fdata-sections` > along with linker's unused-section elimination to get rid of most of the > stuff not necessary for the final image, but I can't remember if > unused-section elimination happens before or after checking for missing > symbols. If it is the latter, then we might be in trouble with this approach. > I will have a look into this when I get back to work. Come to think of it, I'm 90% sure it's the latter (I don't see how the former can work - the linker has to load all the objects while resolving all the dependencies, then only it can get rid of the stuff the final image doesn't really need). The linker will give up as soon as it hits a missing symbol referred from a section which is actually unused in the final image (but is within some object which contains sections that are actually needed for the image). Of course I need to confirm that 10% when I get my hands on the linker, but I have a feeling this is going to be a blocker for us. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer
> On May 27, 2016, at 2:55 PM, Rafael Espíndola > wrote: > > On 27 May 2016 at 17:32, Vedant Kumar wrote: >> vsk added a comment. >> >> Comments on this patch -- The increment and decrement snippets seem like >> they could be pulled into helper methods. That should make it easier to >> update all users of LLVMIRGeneration. I wasn't able to come up with a >> regression test, but I do think this patch needs one. >> >> Overall comments -- My main concern is that this isn't the only affected >> user of the Timer class. I have a preference for >> http://reviews.llvm.org/D20735 because it defines the underlying problem >> away. I'll defer to someone else on this (maybe @rafael?). > > What is the other recursive use? I meant to say: it may not be the only affected user. E.g I don't know if there are affected users out-of-tree. Some in-tree users are ASTReader, AnalysisConsumer::HandleTranslationUnit, and BackendConsumer. It's not obvious to me at a glance that BackendConsumer is the only affected user, but that could be the case. vedant > > Cheers, > Rafael ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
rsmith accepted this revision. rsmith added a reviewer: rsmith. rsmith added a comment. This revision is now accepted and ready to land. LGTM once the LLVM side is landed. Comment at: include/clang/Basic/DiagnosticLexKinds.td:278 @@ +277,3 @@ +def pp_nonportable_path : Warning< + "non-portable path '%0' found in preprocessor directive">, + InGroup; The fix-it hints aren't shown in some modes of operation; it might be helpful for this diagnostic to be a bit more explicit about what's non-portable since without the fixit it's not obvious. Maybe something like "non-portable path to file '%0'; specified path differs in case from file name on disk" where %0 is the corrected path? Comment at: lib/Lex/PPDirectives.cpp:1763-1765 @@ +1762,5 @@ + // than the one we're about to open. + // + // Because testing for non-portable paths is expensive, only do it if the + // warning is not currently ignored. + const bool CheckIncludePathPortability = Looks like this comment is stale? http://reviews.llvm.org/D19843 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20757: Add "REQUIRES-ANY" feature test
EricWF created this revision. EricWF added reviewers: ddunbar, rnk. EricWF added subscribers: cfe-commits, llvm-commits. EricWF set the repository for this revision to rL LLVM. This patch adds a "REQUIRES-ANY" feature test that is disjunctive. This marks a test as `UNSUPPORTED` if none of the specified features are available. Libc++ has the need to write feature test such as `// REQUIRES-ANY: c++98, c++03` when testing of behavior that is specific to older dialects but has since changed. Repository: rL LLVM http://reviews.llvm.org/D20757 Files: utils/lit/lit/TestRunner.py utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt utils/lit/tests/Inputs/shtest-format/requires-any-present.txt utils/lit/tests/shtest-format.py Index: utils/lit/tests/shtest-format.py === --- utils/lit/tests/shtest-format.py +++ utils/lit/tests/shtest-format.py @@ -47,6 +47,8 @@ # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt # CHECK: PASS: shtest-format :: pass.txt +# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt +# CHECK: PASS: shtest-format :: requires-any-present.txt # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt # CHECK: PASS: shtest-format :: requires-present.txt # CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt @@ -69,9 +71,9 @@ # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt # CHECK: shtest-format :: fail.txt -# CHECK: Expected Passes: 4 +# CHECK: Expected Passes: 5 # CHECK: Expected Failures : 3 -# CHECK: Unsupported Tests : 2 +# CHECK: Unsupported Tests : 3 # CHECK: Unresolved Tests : 1 # CHECK: Unexpected Passes : 1 # CHECK: Unexpected Failures: 3 Index: utils/lit/tests/Inputs/shtest-format/requires-any-present.txt === --- /dev/null +++ utils/lit/tests/Inputs/shtest-format/requires-any-present.txt @@ -0,0 +1,2 @@ +RUN: true +REQUIRES-ANY: a-missing-feature, a-present-feature Index: utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt === --- /dev/null +++ utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt @@ -0,0 +1,2 @@ +RUN: true +REQUIRES-ANY: a-missing-feature, a-missing-feature-2 Index: utils/lit/lit/TestRunner.py === --- utils/lit/lit/TestRunner.py +++ utils/lit/lit/TestRunner.py @@ -616,8 +616,10 @@ sourcepath = test.getSourcePath() script = [] requires = [] +requires_any = [] unsupported = [] -keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'UNSUPPORTED:', 'END.'] +keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'REQUIRES-ANY:', +'UNSUPPORTED:', 'END.'] for line_number, command_type, ln in \ parseIntegratedTestScriptCommands(sourcepath, keywords): if command_type == 'RUN': @@ -642,6 +644,8 @@ test.xfails.extend([s.strip() for s in ln.split(',')]) elif command_type == 'REQUIRES': requires.extend([s.strip() for s in ln.split(',')]) +elif command_type == 'REQUIRES-ANY': +requires_any.extend([s.strip() for s in ln.split(',')]) elif command_type == 'UNSUPPORTED': unsupported.extend([s.strip() for s in ln.split(',')]) elif command_type == 'END': @@ -668,6 +672,12 @@ msg = ', '.join(missing_required_features) return lit.Test.Result(Test.UNSUPPORTED, "Test requires the following features: %s" % msg) +requires_any_features = [f for f in requires_any + if f in test.config.available_features] +if requires_any and not requires_any_features: +msg = ' ,'.join(requires_any) +return lit.Test.Result(Test.UNSUPPORTED, +"Test requires any of the following features: %s" % msg) unsupported_features = [f for f in unsupported if f in test.config.available_features] if unsupported_features: Index: utils/lit/tests/shtest-format.py === --- utils/lit/tests/shtest-format.py +++ utils/lit/tests/shtest-format.py @@ -47,6 +47,8 @@ # CHECK: UNRESOLVED: shtest-format :: no-test-line.txt # CHECK: PASS: shtest-format :: pass.txt +# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt +# CHECK: PASS: shtest-format :: requires-any-present.txt # CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt # CHECK: PASS: shtest-format :: requires-present.txt # CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt @@ -69,9 +71,9 @@ # CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt # CHECK: shtest-format :: fail.txt -# CHECK: Expected Passes: 4 +# CHECK: Expected Passes: 5 # CHECK: Expected Failures : 3 -# CHECK: Unsupported Tests :
Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.
eric_niebler added a comment. Awesome, thanks. Comment at: include/clang/Basic/DiagnosticLexKinds.td:278 @@ +277,3 @@ +def pp_nonportable_path : Warning< + "non-portable path '%0' found in preprocessor directive">, + InGroup; rsmith wrote: > The fix-it hints aren't shown in some modes of operation; it might be helpful > for this diagnostic to be a bit more explicit about what's non-portable since > without the fixit it's not obvious. Maybe something like > > "non-portable path to file '%0'; specified path differs in case from file > name on disk" > > where %0 is the corrected path? Good suggestion. Comment at: lib/Lex/PPDirectives.cpp:1763-1765 @@ +1762,5 @@ + // than the one we're about to open. + // + // Because testing for non-portable paths is expensive, only do it if the + // warning is not currently ignored. + const bool CheckIncludePathPortability = rsmith wrote: > Looks like this comment is stale? Oops, yeah. http://reviews.llvm.org/D19843 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Missing definition of a template virtual function
On Fri, May 27, 2016 at 1:03 PM, Srivastava, Sunil via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Hi, > > > > I want to discuss the issue in PR27895, > >https://llvm.org/bugs/show_bug.cgi?id=27895 > > > > But I will give a slightly different example for this discussion. > > > > The issue can be demonstrated by this standalone code. Should this example > link > > successfully? > Yes, this is a bug. We emit a direct call to TmplWithArray::operator[] so we're required to also emit a definition of it. I think the code that r227073 removed was really masking this bug rather than fixing it. It seems like there are two issues here: 1) Sema should mark a virtual function as used if it sees an obviously-devirtualizable call to the function (where the base object has a known dynamic type) 2) Clang CodeGen's devirtualization of obviously-devirtualizable calls should not devirtualize calls to linkonce_odr functions that it can't emit -- > > template < typename T, int N = 0 > class TmplWithArray { > > public: > > virtual T& operator [] (int idx); > > T ar[N+1]; > > }; > > template T& TmplWithArray::operator[](int idx) { > > return ar[idx]; > > } > > class Wrapper { > > TmplWithArray data; > > bool indexIt(int a); > > }; > > bool Wrapper::indexIt(int a) > > { > >return data[a]; > > } > > int main(){} > > -- > > > > Starting from r227073 it does not link (at any optimization level). The > code > > has a direct call to the operator[] function, but that function definition > is > > not generated. > > > > Versions prior to r227073, > > - at –O0 or –O1, generate the operator[] function and the direct > call, and > > - at –O2 do not generate the function, but inline it > > Either way they link fine. > > > > In this example the key-function for the generation of the vtable is the > > operator[] function itself. > > > > So the compiler can either generate both the vtable and the operator[] > > function, or not generate either; they are both consistent states. > > > > The call in data[a] is to a virtual function, and if the compiler left it > as a > > virtual call, it will link. There will be no ctor, no vtable, and no > operator[] > > function. Wrapper::indexIt will be dead code, but it will link. > > > > But the compiler does devirtualization of the call and generates a direct > call, > > yet, beginning with r227073, it does not generate the operator[] function. > > Hence the link failure. > > > > Another interesting tidbit is that if the operator[] is replaced by a plain > > function doing the same thing, along with the corresponding change in the > > usage, something like: > > virtual T& getElt(int idx); > > then the behavior is the same as pre r227073. Either getElt is defined or > it > > gets inlined. > > > > BTW, this is not just an idle curiosity. This example was trimmed down from > > a user bug report having a link failure. > > > > Sunil Srivastava > > Sony Interactive Entertainment > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits