[llvm-branch-commits] [llvm-objcopy] Support CREL (PR #97521)
https://github.com/dwblaikie commented: Not that the patch is especially long/complicated, but could be split into the refactor/move of the MC function, then the new usage, if you like (usual reasons - smaller patches are easier to root cause, functionality can be reverted without thrashing the refactored code (or refactored code can be reverted if issues are found in that before the usage goes in), etc) https://github.com/llvm/llvm-project/pull/97521 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [GSYM] Include end_sequence debug_line rows in Dwarf transform (PR #90535)
@@ -424,19 +439,13 @@ static void convertFunctionLineTable(OutputAggregator , CUInfo , auto LastLE = FI.OptLineTable->last(); if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line) continue; + // Only push a row if it isn't an end sequence. End sequence markers are // included for the last address in a function or the last contiguous // address in a sequence. -if (Row.EndSequence) { dwblaikie wrote: I'm not quite following the collection of thoughts here, they seem disjoint to me, so trying to discuss: > We used to not break out on Row.EndSequence I don't understand the relationship between end_sequence and functions with discontiguous ranges - could you describe this connection in more detail? > as it allows functions to have discontiguous ranges. Agreed with @pogo59, I believe both Bolt and Propeller can create discontiguous address ranges for a function (but you'll see DW_AT_ranges on the subprogram) > I was assuming that if we asked for the rows for a given address range we > wouldn't get all entries if two merged functions with different line table > entries were found, but that assumption might not be correct? Yeah, looking at the implementation of `lookupAddressRangeImpl` it finds a single sequence that starts closest to the start address, then adds all rows within that sequence that cover the range requested. So, no, it won't retrieve addresses/ranges from multiple sequences. https://github.com/llvm/llvm-project/pull/90535 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [GSYM][DWARF] Include end_sequence debug_line rows when looking up addr ranges (PR #89703)
dwblaikie wrote: Oh, sorry, right - that API should/might be used by `llvm-symbolizer` and the change might be visible through its behavior? https://github.com/llvm/llvm-project/pull/89703 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [GSYM][DWARF] Include end_sequence debug_line rows when looking up addr ranges (PR #89703)
dwblaikie wrote: > I'd like to know how this affects the output of llvm-dwarfdump. Intuitively > it feels like something around the display of end_sequence rows should have > changed, but I'm willing to be corrected. +1 - given the change to DWARFDebugLine, I'd expect this to be observable through llvm-dwarfdump, and if that's the case, it should be probably two patches - one to change DWARFDebugLine and with a lit test for llvm-dwarfdump, then a separate change to use this from gsym https://github.com/llvm/llvm-project/pull/89703 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (PR #83702)
https://github.com/dwblaikie approved this pull request. https://github.com/llvm/llvm-project/pull/83702 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 78d41a1 - lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms
Author: David Blaikie Date: 2021-01-24T18:39:06-08:00 New Revision: 78d41a1295d9d40c37758230d0218c61eaffad88 URL: https://github.com/llvm/llvm-project/commit/78d41a1295d9d40c37758230d0218c61eaffad88 DIFF: https://github.com/llvm/llvm-project/commit/78d41a1295d9d40c37758230d0218c61eaffad88.diff LOG: lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms Finishing out the support (to the best of my knowledge/based on current testing running the whole check-lldb with a clang forcibly using DW_AT_ranges on all DW_TAG_subprograms) for this feature. Differential Revision: https://reviews.llvm.org/D94064 Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index afad21af240c..3656c7333f27 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -35,6 +35,7 @@ #include "lldb/Interpreter/OptionValueProperties.h" #include "Plugins/ExpressionParser/Clang/ClangUtil.h" +#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/CompileUnit.h" @@ -3040,8 +3041,12 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext ) { if (sc.function) { DWARFDIE function_die = GetDIE(sc.function->GetID()); - const dw_addr_t func_lo_pc = function_die.GetAttributeValueAsAddress( - DW_AT_low_pc, LLDB_INVALID_ADDRESS); + dw_addr_t func_lo_pc = LLDB_INVALID_ADDRESS; + DWARFRangeList ranges; + if (function_die.GetDIE()->GetAttributeAddressRanges( + function_die.GetCU(), ranges, + /*check_hi_lo_pc=*/true)) +func_lo_pc = ranges.GetMinRangeBase(0); if (func_lo_pc != LLDB_INVALID_ADDRESS) { const size_t num_variables = ParseVariables( sc, function_die.GetFirstChild(), func_lo_pc, true, true); diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s index 1ff883c67f9e..4dd398d86549 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s +++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s @@ -1,32 +1,53 @@ .text - .file "main.c" + .file "subprogram_ranges.c" .globl main# -- Begin function main .p2align4, 0x90 .type main,@function main: # @main .Lfunc_begin0: - .file 1 "/usr/local/google/home/blaikie/dev/scratch" "main.c" - .loc1 1 0 # main.c:1:0 + .file 1 "/usr/local/google/home/blaikie/dev/scratch" "subprogram_ranges.c" + .loc1 2 0 # subprogram_ranges.c:2:0 .cfi_startproc # %bb.0:# %entry - pushq %rbp - .cfi_def_cfa_offset 16 - .cfi_offset %rbp, -16 - movq%rsp, %rbp - .cfi_def_cfa_register %rbp - xorl%eax, %eax + #DEBUG_VALUE: main:var <- 3 + .loc1 4 5 prologue_end # subprogram_ranges.c:4:5 + movl$1, i(%rip) .Ltmp0: - .loc1 2 7 prologue_end # main.c:2:7 - movl$3, -4(%rbp) - .loc1 3 1 # main.c:3:1 - popq%rbp - .cfi_def_cfa %rsp, 8 + #DEBUG_VALUE: main:var <- 5 + .loc1 6 5 # subprogram_ranges.c:6:5 + movl$2, i(%rip) + .loc1 7 1 # subprogram_ranges.c:7:1 + xorl%eax, %eax retq .Ltmp1: .Lfunc_end0: .size main, .Lfunc_end0-main .cfi_endproc # -- End function + .type i,@object # @i + .bss + .globl i + .p2align2 +i: + .long 0 # 0x0 + .size i, 4 + + .section.debug_loc,"",@progbits +.Ldebug_loc0: + .quad .Lfunc_begin0-.Lfunc_begin0 + .quad .Ltmp0-.Lfunc_begin0 + .short 3 # Loc expr size + .byte 17 # DW_OP_consts + .byte 3 # 3 + .byte 159 # DW_OP_stack_value + .quad .Ltmp0-.Lfunc_begin0 + .quad .Lfunc_end0-.Lfunc_begin0 + .short 3 # Loc expr size + .byte 17 # DW_OP_consts +
[llvm-branch-commits] [llvm] b3fcc72 - Fix sign-comparison warnings in unit test EXPECTs
Author: David Blaikie Date: 2021-01-24T18:38:16-08:00 New Revision: b3fcc72eb07c43ca08dade818018c82275081ec3 URL: https://github.com/llvm/llvm-project/commit/b3fcc72eb07c43ca08dade818018c82275081ec3 DIFF: https://github.com/llvm/llvm-project/commit/b3fcc72eb07c43ca08dade818018c82275081ec3.diff LOG: Fix sign-comparison warnings in unit test EXPECTs Added: Modified: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp Removed: diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp index 1efe9d0ceaf4..3c2cc35bd65c 100644 --- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp +++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp @@ -1197,7 +1197,7 @@ TEST_F(OpenMPIRBuilderTest, TileSingleLoop) { OMPBuilder.finalize(); EXPECT_FALSE(verifyModule(*M, ())); - EXPECT_EQ(GenLoops.size(), 2); + EXPECT_EQ(GenLoops.size(), 2u); CanonicalLoopInfo *Floor = GenLoops[0]; CanonicalLoopInfo *Tile = GenLoops[1]; @@ -1264,7 +1264,7 @@ TEST_F(OpenMPIRBuilderTest, TileNestedLoops) { OMPBuilder.finalize(); EXPECT_FALSE(verifyModule(*M, ())); - EXPECT_EQ(GenLoops.size(), 4); + EXPECT_EQ(GenLoops.size(), 4u); CanonicalLoopInfo *Floor1 = GenLoops[0]; CanonicalLoopInfo *Floor2 = GenLoops[1]; CanonicalLoopInfo *Tile1 = GenLoops[2]; @@ -1366,7 +1366,7 @@ TEST_F(OpenMPIRBuilderTest, TileNestedLoopsWithBounds) { OMPBuilder.finalize(); EXPECT_FALSE(verifyModule(*M, ())); - EXPECT_EQ(GenLoops.size(), 4); + EXPECT_EQ(GenLoops.size(), 4u); CanonicalLoopInfo *Floor0 = GenLoops[0]; CanonicalLoopInfo *Floor1 = GenLoops[1]; CanonicalLoopInfo *Tile0 = GenLoops[2]; @@ -1476,42 +1476,42 @@ TEST_F(OpenMPIRBuilderTest, TileSingleLoopCounts) { }; // Empty iteration domain. - EXPECT_EQ(GetFloorCount(0, 0, 1, false, false, 7), 0); - EXPECT_EQ(GetFloorCount(0, -1, 1, false, true, 7), 0); - EXPECT_EQ(GetFloorCount(-1, -1, -1, true, false, 7), 0); - EXPECT_EQ(GetFloorCount(-1, 0, -1, true, true, 7), 0); - EXPECT_EQ(GetFloorCount(-1, -1, 3, true, false, 7), 0); + EXPECT_EQ(GetFloorCount(0, 0, 1, false, false, 7), 0u); + EXPECT_EQ(GetFloorCount(0, -1, 1, false, true, 7), 0u); + EXPECT_EQ(GetFloorCount(-1, -1, -1, true, false, 7), 0u); + EXPECT_EQ(GetFloorCount(-1, 0, -1, true, true, 7), 0u); + EXPECT_EQ(GetFloorCount(-1, -1, 3, true, false, 7), 0u); // Only complete tiles. - EXPECT_EQ(GetFloorCount(0, 14, 1, false, false, 7), 2); - EXPECT_EQ(GetFloorCount(0, 14, 1, false, false, 7), 2); - EXPECT_EQ(GetFloorCount(1, 15, 1, false, false, 7), 2); - EXPECT_EQ(GetFloorCount(0, -14, -1, true, false, 7), 2); - EXPECT_EQ(GetFloorCount(-1, -14, -1, true, true, 7), 2); - EXPECT_EQ(GetFloorCount(0, 3 * 7 * 2, 3, false, false, 7), 2); + EXPECT_EQ(GetFloorCount(0, 14, 1, false, false, 7), 2u); + EXPECT_EQ(GetFloorCount(0, 14, 1, false, false, 7), 2u); + EXPECT_EQ(GetFloorCount(1, 15, 1, false, false, 7), 2u); + EXPECT_EQ(GetFloorCount(0, -14, -1, true, false, 7), 2u); + EXPECT_EQ(GetFloorCount(-1, -14, -1, true, true, 7), 2u); + EXPECT_EQ(GetFloorCount(0, 3 * 7 * 2, 3, false, false, 7), 2u); // Only a partial tile. - EXPECT_EQ(GetFloorCount(0, 1, 1, false, false, 7), 1); - EXPECT_EQ(GetFloorCount(0, 6, 1, false, false, 7), 1); - EXPECT_EQ(GetFloorCount(-1, 1, 3, true, false, 7), 1); - EXPECT_EQ(GetFloorCount(-1, -2, -1, true, false, 7), 1); - EXPECT_EQ(GetFloorCount(0, 2, 3, false, false, 7), 1); + EXPECT_EQ(GetFloorCount(0, 1, 1, false, false, 7), 1u); + EXPECT_EQ(GetFloorCount(0, 6, 1, false, false, 7), 1u); + EXPECT_EQ(GetFloorCount(-1, 1, 3, true, false, 7), 1u); + EXPECT_EQ(GetFloorCount(-1, -2, -1, true, false, 7), 1u); + EXPECT_EQ(GetFloorCount(0, 2, 3, false, false, 7), 1u); // Complete and partial tiles. - EXPECT_EQ(GetFloorCount(0, 13, 1, false, false, 7), 2); - EXPECT_EQ(GetFloorCount(0, 15, 1, false, false, 7), 3); - EXPECT_EQ(GetFloorCount(-1, -14, -1, true, false, 7), 2); - EXPECT_EQ(GetFloorCount(0, 3 * 7 * 5 - 1, 3, false, false, 7), 5); - EXPECT_EQ(GetFloorCount(-1, -3 * 7 * 5, -3, true, false, 7), 5); + EXPECT_EQ(GetFloorCount(0, 13, 1, false, false, 7), 2u); + EXPECT_EQ(GetFloorCount(0, 15, 1, false, false, 7), 3u); + EXPECT_EQ(GetFloorCount(-1, -14, -1, true, false, 7), 2u); + EXPECT_EQ(GetFloorCount(0, 3 * 7 * 5 - 1, 3, false, false, 7), 5u); + EXPECT_EQ(GetFloorCount(-1, -3 * 7 * 5, -3, true, false, 7), 5u); // Close to 16-bit integer range. - EXPECT_EQ(GetFloorCount(0, 0x, 1, false, false, 1), 0x); - EXPECT_EQ(GetFloorCount(0, 0x, 1, false, false, 7), 0x / 7 + 1); - EXPECT_EQ(GetFloorCount(0, 0xFFFE, 1, false, true, 7), 0x / 7 + 1); - EXPECT_EQ(GetFloorCount(-0x8000, 0x7FFF, 1, true, false, 7), 0x / 7 + 1); - EXPECT_EQ(GetFloorCount(-0x7FFF, 0x7FFF, 1, true, true, 7), 0x / 7 + 1); - EXPECT_EQ(GetFloorCount(0, 0xFFFE, 1, false, false,
[llvm-branch-commits] [llvm] 76f5c5a - [ADT][Support] Fix C4146 error from MSVC
Author: Vladislav Vinogradov Date: 2021-01-15T14:34:14-08:00 New Revision: 76f5c5a7b059929f0e0352ad4ff5ec1b78511868 URL: https://github.com/llvm/llvm-project/commit/76f5c5a7b059929f0e0352ad4ff5ec1b78511868 DIFF: https://github.com/llvm/llvm-project/commit/76f5c5a7b059929f0e0352ad4ff5ec1b78511868.diff LOG: [ADT][Support] Fix C4146 error from MSVC Unary minus operator applied to unsigned type, result still unsigned. Use `~0U` instead of `-1U` and `1 + ~VAL` instead of `-VAL`. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D94417 Added: Modified: llvm/include/llvm/ADT/StringExtras.h llvm/include/llvm/Support/MathExtras.h Removed: diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index caa1ed547bb2..fe5c5967a2cf 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -71,7 +71,7 @@ inline unsigned hexDigitValue(char C) { constexpr HexTable() { // Default initialize everything to invalid. for (int i = 0; i < 255; ++i) -LUT[i] = -1U; +LUT[i] = ~0U; // Initialize `0`-`9`. for (int i = 0; i < 10; ++i) LUT['0' + i] = i; @@ -88,7 +88,7 @@ inline unsigned hexDigitValue(char C) { inline bool isDigit(char C) { return C >= '0' && C <= '9'; } /// Checks if character \p C is a hexadecimal numeric character. -inline bool isHexDigit(char C) { return hexDigitValue(C) != -1U; } +inline bool isHexDigit(char C) { return hexDigitValue(C) != ~0U; } /// Checks if character \p C is a valid letter as classified by "C" locale. inline bool isAlpha(char C) { @@ -184,7 +184,7 @@ inline std::string toHex(ArrayRef Input, bool LowerCase = false) { inline bool tryGetHexFromNibbles(char MSB, char LSB, uint8_t ) { unsigned U1 = hexDigitValue(MSB); unsigned U2 = hexDigitValue(LSB); - if (U1 == -1U || U2 == -1U) + if (U1 == ~0U || U2 == ~0U) return false; Hex = static_cast((U1 << 4) | U2); @@ -291,7 +291,7 @@ inline std::string utostr(uint64_t X, bool isNeg = false) { inline std::string itostr(int64_t X) { if (X < 0) -return utostr(-static_cast(X), true); +return utostr(static_cast(1) + ~static_cast(X), true); else return utostr(static_cast(X)); } diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index 16da3046c8ce..33b9065261e8 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -440,7 +440,7 @@ inline uint64_t maxUIntN(uint64_t N) { inline int64_t minIntN(int64_t N) { assert(N > 0 && N <= 64 && "integer width out of range"); - return -(UINT64_C(1)<<(N-1)); + return UINT64_C(1) + ~(UINT64_C(1) << (N - 1)); } /// Gets the maximum value for a N-bit signed integer. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 854f098 - Fix llvm::Optional build breaks in MSVC using std::is_trivially_copyable
Author: James Player Date: 2021-01-13T15:23:48-08:00 New Revision: 854f0984f0b7ab9a9a541a4bcda7ea173e4113d3 URL: https://github.com/llvm/llvm-project/commit/854f0984f0b7ab9a9a541a4bcda7ea173e4113d3 DIFF: https://github.com/llvm/llvm-project/commit/854f0984f0b7ab9a9a541a4bcda7ea173e4113d3.diff LOG: Fix llvm::Optional build breaks in MSVC using std::is_trivially_copyable Current code breaks this version of MSVC due to a mismatch between `std::is_trivially_copyable` and `llvm::is_trivially_copyable` for `std::pair` instantiations. Hence I was attempting to use `std::is_trivially_copyable` to set `llvm::is_trivially_copyable::value`. I spent some time root causing an `llvm::Optional` build error on MSVC 16.8.3 related to the change described above: ``` 62>C:\src\ocg_llvm\llvm-project\llvm\include\llvm/ADT/BreadthFirstIterator.h(96,12): error C2280: 'llvm::Optional::NodeSubset> *,llvm::Optional::ChildIterator>>> ::Optional::NodeSubset> *,llvm::Optional::ChildIterator>>>::operator =(const llvm::Optional::NodeSubset> *,llvm::Optional::ChildIterator>>> &)': attempting to reference a deleted function (compiling source file C:\src\ocg_llvm\llvm-project\llvm\unittests\ADT\BreadthFirstIteratorTest.cpp) ... ``` The "trivial" specialization of `optional_detail::OptionalStorage` assumes that the value type is trivially copy constructible and trivially copy assignable. The specialization is invoked based on a check of `is_trivially_copyable` alone, which does not imply both `is_trivially_copy_assignable` and `is_trivially_copy_constructible` are true. [[ https://en.cppreference.com/w/cpp/named_req/TriviallyCopyable | According to the spec ]], a deleted assignment operator does not make `is_trivially_copyable` false. So I think all these properties need to be checked explicitly in order to specialize `OptionalStorage` to the "trivial" version: ``` /// Storage for any type. template ::value && std::is_trivially_copy_assignable::value> class OptionalStorage { ``` Above fixed my build break in MSVC, but I think we need to explicitly check `is_trivially_copy_constructible` too since it might be possible the copy constructor is deleted. Also would be ideal to move over to `std::is_trivially_copyable` instead of the `llvm` namespace verson. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D93510 Added: Modified: llvm/include/llvm/ADT/Optional.h llvm/unittests/ADT/OptionalTest.cpp Removed: diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h index daa9ee627fa9..820e586ff7dd 100644 --- a/llvm/include/llvm/ADT/Optional.h +++ b/llvm/include/llvm/ADT/Optional.h @@ -33,7 +33,12 @@ namespace optional_detail { struct in_place_t {}; /// Storage for any type. -template ::value> +template ::value && + std::is_trivially_copy_assignable::value && + (std::is_trivially_move_constructible::value || + !std::is_move_constructible::value) && + (std::is_trivially_move_assignable::value || + !std::is_move_assignable::value))> class OptionalStorage { union { char empty; diff --git a/llvm/unittests/ADT/OptionalTest.cpp b/llvm/unittests/ADT/OptionalTest.cpp index c7fa796a2d7f..235b834887d1 100644 --- a/llvm/unittests/ADT/OptionalTest.cpp +++ b/llvm/unittests/ADT/OptionalTest.cpp @@ -390,6 +390,127 @@ TEST(OptionalTest, ImmovableEmplace) { EXPECT_EQ(0u, Immovable::Destructions); } +// Craft a class which is_trivially_copyable, but not +// is_trivially_copy_constructible. +struct NonTCopy { + NonTCopy() = default; + + // Delete the volatile copy constructor to engage the "rule of 3" and delete + // any unspecified copy assignment or constructor. + NonTCopy(volatile NonTCopy const &) = delete; + + // Leave the non-volatile default copy constructor unspecified (deleted by + // rule of 3) + + // This template can serve as the copy constructor, but isn't chosen + // by =default in a class with a 'NonTCopy' member. + template + NonTCopy(Self const ) : Val(Other.Val) {} + + NonTCopy =(NonTCopy const &) = default; + + int Val{0}; +}; + +#if defined(_MSC_VER) && _MSC_VER >= 1927 +// Currently only true on recent MSVC releases. +static_assert(std::is_trivially_copyable::value, + "Expect NonTCopy to be trivially copyable"); + +static_assert(!std::is_trivially_copy_constructible::value, + "Expect NonTCopy not to be trivially copy constructible."); +#endif // defined(_MSC_VER) && _MSC_VER >= 1927 + +TEST(OptionalTest, DeletedCopyConstructor) { + + // Expect compile to fail if 'trivial' version of + // optional_detail::OptionalStorage is chosen. + using NonTCopyOptT = Optional; + NonTCopyOptT NonTCopy1; + + // Check that the Optional can be
[llvm-branch-commits] [mlir] 0d88d7d - Delete unused function (was breaking the -Werror build)
Author: David Blaikie Date: 2021-01-12T15:29:44-08:00 New Revision: 0d88d7d82bc44b211a8187650a06c6cd3492186a URL: https://github.com/llvm/llvm-project/commit/0d88d7d82bc44b211a8187650a06c6cd3492186a DIFF: https://github.com/llvm/llvm-project/commit/0d88d7d82bc44b211a8187650a06c6cd3492186a.diff LOG: Delete unused function (was breaking the -Werror build) Added: Modified: mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp Removed: diff --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp index 8f02f3d83cf1..0deb4e3f59ae 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -350,32 +350,6 @@ bool mlir::linalg::isFusableInto(const LinalgDependenceGraph , return true; } -static bool isSameSubView(Value a, Value b) { - if (a == b) -return true; - auto sva = a.getDefiningOp(); - auto svb = b.getDefiningOp(); - if (!sva || !svb) -return false; - if (!isSameSubView(sva.getViewSource(), svb.getViewSource())) -return false; - if (sva.getType() != svb.getType()) -return false; - if (sva.getNumOperands() != svb.getNumOperands()) -return false; - if (sva.static_offsets() != svb.static_offsets()) -return false; - if (sva.static_sizes() != svb.static_sizes()) -return false; - if (sva.static_strides() != svb.static_strides()) -return false; - /// Skip the "source" operand. - for (unsigned idx = 1, e = sva.getNumOperands(); idx != e; ++idx) -if (sva.getOperand(idx) != svb.getOperand(idx)) - return false; - return true; -} - static Optional findFusableProducer(OpOperand , const LinalgDependenceGraph ) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 33c8e16 - PR47391: Canonicalize DIFiles
Author: Umesh Kalappa Date: 2021-01-08T22:11:16-08:00 New Revision: 33c8e16f660de9bbe177c1bf821063c146278d8e URL: https://github.com/llvm/llvm-project/commit/33c8e16f660de9bbe177c1bf821063c146278d8e DIFF: https://github.com/llvm/llvm-project/commit/33c8e16f660de9bbe177c1bf821063c146278d8e.diff LOG: PR47391: Canonicalize DIFiles Like @aprantl suggested, modify to use the canonicalized DIFile, if we don't know the loc info and filename for the compiler generated functions for example static initialization functions. Reviewed By: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D87147 Added: clang/test/CodeGenCXX/difile_entry.cpp Modified: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGen/debug-info-oslog.c Removed: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 7b20d43b0f17..8bc28b28c048 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -404,17 +404,23 @@ Optional CGDebugInfo::getSource(const SourceManager , } llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) { - if (!Loc.isValid()) -// If Location is not valid then use main input file. -return TheCU->getFile(); - SourceManager = CGM.getContext().getSourceManager(); - PresumedLoc PLoc = SM.getPresumedLoc(Loc); + StringRef FileName; + FileID FID; - StringRef FileName = PLoc.getFilename(); - if (PLoc.isInvalid() || FileName.empty()) -// If the location is not valid then use main input file. -return TheCU->getFile(); + if (Loc.isInvalid()) { +FileName = TheCU->getFile()->getFilename(); + } else { +PresumedLoc PLoc = SM.getPresumedLoc(Loc); +FileName = PLoc.getFilename(); + +if (FileName.empty()) { + FileName = TheCU->getFile()->getFilename(); +} else { + FileName = PLoc.getFilename(); +} +FID = PLoc.getFileID(); + } // Cache the results. auto It = DIFileCache.find(FileName.data()); @@ -426,11 +432,7 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) { SmallString<32> Checksum; - // Compute the checksum if possible. If the location is affected by a #line - // directive that refers to a file, PLoc will have an invalid FileID, and we - // will correctly get no checksum. - Optional CSKind = - computeChecksum(PLoc.getFileID(), Checksum); + Optional CSKind = computeChecksum(FID, Checksum); Optional> CSInfo; if (CSKind) CSInfo.emplace(*CSKind, Checksum); diff --git a/clang/test/CodeGen/debug-info-oslog.c b/clang/test/CodeGen/debug-info-oslog.c index c32c79eb8a6f..11a1cd64dedf 100644 --- a/clang/test/CodeGen/debug-info-oslog.c +++ b/clang/test/CodeGen/debug-info-oslog.c @@ -11,5 +11,5 @@ void test_builtin_os_log(void *buf, int i, const char *data) { // number between file and type. // CHECK: distinct !DISubprogram(name: "__os_log_helper_1_0_1_4_0", -// CHECK-SAME: file: !{{[0-9+]}}, type +// CHECK-SAME: file: !{{.*}}, type // CHECK-SAME: flags: DIFlagArtificial diff --git a/clang/test/CodeGenCXX/difile_entry.cpp b/clang/test/CodeGenCXX/difile_entry.cpp new file mode 100644 index ..9ef80fe8184c --- /dev/null +++ b/clang/test/CodeGenCXX/difile_entry.cpp @@ -0,0 +1,12 @@ +// RUN: rm -rf %t/test_dir +// RUN: mkdir -p %t/test_dir +// RUN: cd %t/test_dir +// RUN: cp %s . +// RUN: %clang_cc1 -main-file-name difile_entry.cpp -debug-info-kind=limited ../test_dir/difile_entry.cpp -std=c++11 -emit-llvm -o - | FileCheck ../test_dir/difile_entry.cpp +int x(); +static int i = x(); + +// CHECK: [[FILE: *]] = !DIFile(filename: "{{.*}}difile_entry.cpp", +// CHECK: {{.*}} = distinct !DISubprogram(name: "__cxx_global_var_init", scope: {{.*}}, file: [[FILE]] +// CHECK: {{.*}} = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_difile_entry.cpp", scope: {{.*}}, file: [[FILE]] + ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 2ff36e7 - lldb subprogram_ranges.test - remove dependence on temp file name
Author: David Blaikie Date: 2021-01-07T20:04:22-08:00 New Revision: 2ff36e79291486b489ae26418daa1b123473b405 URL: https://github.com/llvm/llvm-project/commit/2ff36e79291486b489ae26418daa1b123473b405 DIFF: https://github.com/llvm/llvm-project/commit/2ff36e79291486b489ae26418daa1b123473b405.diff LOG: lldb subprogram_ranges.test - remove dependence on temp file name Added: Modified: lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test Removed: diff --git a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test index a6fa5f8ce7a5..740cd35b0f3b 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test +++ b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test @@ -16,4 +16,4 @@ b main # CHECK: (lldb) b main -# CHECK-NEXT: Breakpoint 1: where = subprogram_ranges.test.tmp.out`main + 6 at main.c:2:7 +# CHECK-NEXT: Breakpoint 1: where = {{.*}}`main + 6 at main.c:2:7 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 4a3c2ba - Fix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses the test temp paths instead)
Author: David Blaikie Date: 2021-01-07T19:57:14-08:00 New Revision: 4a3c2ba890460a209b289dca525e9de6f8ad0af3 URL: https://github.com/llvm/llvm-project/commit/4a3c2ba890460a209b289dca525e9de6f8ad0af3 DIFF: https://github.com/llvm/llvm-project/commit/4a3c2ba890460a209b289dca525e9de6f8ad0af3.diff LOG: Fix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses the test temp paths instead) Added: Modified: llvm/test/Analysis/DDG/print-dot-ddg.ll Removed: diff --git a/llvm/test/Analysis/DDG/print-dot-ddg.ll b/llvm/test/Analysis/DDG/print-dot-ddg.ll index 8a4d55bc2e8b..939fde1639c5 100644 --- a/llvm/test/Analysis/DDG/print-dot-ddg.ll +++ b/llvm/test/Analysis/DDG/print-dot-ddg.ll @@ -1,7 +1,7 @@ -; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=out.full < %s 2>&1 > /dev/null -; RUN: FileCheck %s -input-file=out.full.foo.for.body.dot -; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=out.only -dot-ddg-only < %s 2>&1 > /dev/null -; RUN: FileCheck %s -input-file=out.only.foo.for.body.dot -check-prefix=CHECK-ONLY +; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=%t < %s 2>&1 > /dev/null +; RUN: FileCheck %s -input-file=%t.foo.for.body.dot +; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=%t -dot-ddg-only < %s 2>&1 > /dev/null +; RUN: FileCheck %s -input-file=%t.foo.for.body.dot -check-prefix=CHECK-ONLY target datalayout = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 696775d - Fix subprogram_ranges.test by explicitly using lld
Author: David Blaikie Date: 2021-01-07T19:53:17-08:00 New Revision: 696775d96ecd20aacb7935541995a5554bb32ba8 URL: https://github.com/llvm/llvm-project/commit/696775d96ecd20aacb7935541995a5554bb32ba8 DIFF: https://github.com/llvm/llvm-project/commit/696775d96ecd20aacb7935541995a5554bb32ba8.diff LOG: Fix subprogram_ranges.test by explicitly using lld Seems consistent with the way other tests in this directory do linking Added: Modified: lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test Removed: diff --git a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test index 13186e39b9d1..a6fa5f8ce7a5 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test +++ b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test @@ -1,6 +1,8 @@ # REQUIRES: x86 -# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o %t.out -# RUN: %lldb -b -s %s %t.out 2>&1 | FileCheck %s +# REQUIRES: lld +# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o %t.o -c +# RUN: ld.lld %t.o -o %t +# RUN: %lldb -b -s %s %t 2>&1 | FileCheck %s # Test breaking on symbols and printing variables when a DW_TAG_subprogram uses # DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc. While the assembly here ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] b12f267 - Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""
Author: David Blaikie Date: 2021-01-07T18:18:23-08:00 New Revision: b12f26733a4259c90e5f387aceb9f23c35e003b8 URL: https://github.com/llvm/llvm-project/commit/b12f26733a4259c90e5f387aceb9f23c35e003b8 DIFF: https://github.com/llvm/llvm-project/commit/b12f26733a4259c90e5f387aceb9f23c35e003b8.diff LOG: Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""" This reverts commit d2ddc694ff94743d9735aaf07edcaf6db8aaca04. This still contains a circular dependency between Analysis and CrossTU: $ grep -r include.*Analysis clang/include/clang/CrossTU clang/include/clang/CrossTU/CrossTranslationUnit.h: #include "clang/Analysis/CrossTUAnalysisHelper.h" $ grep -r include.*CrossTU clang/lib/Analysis clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp: #include "clang/CrossTU/CrossTranslationUnit.h" clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp: #include "clang/Analysis/CrossTUAnalysisHelper.h" Added: clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp Modified: clang/include/clang/CrossTU/CrossTranslationUnit.h clang/include/clang/StaticAnalyzer/Core/Analyses.def clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h clang/include/clang/module.modulemap clang/lib/Analysis/CMakeLists.txt clang/lib/CrossTU/CrossTranslationUnit.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/StaticAnalyzer/Core/CMakeLists.txt clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Removed: clang/include/clang/Analysis/CrossTUAnalysisHelper.h clang/include/clang/Analysis/PathDiagnosticConsumers.def clang/include/clang/Analysis/PathDiagnosticConsumers.h clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp clang/lib/Analysis/TextPathDiagnosticConsumer.cpp diff --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h deleted file mode 100644 index 500e78ddedcf.. --- a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h +++ /dev/null @@ -1,41 +0,0 @@ -//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// -#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H -#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H - -#include "llvm/ADT/Optional.h" -#include "clang/Basic/SourceManager.h" - -namespace clang { - -class ASTUnit; - -/// This class is an abstract interface acting as a bridge between -/// an analysis that requires lookups across translation units (a user -/// of that interface) and the facility that implements such lookups -/// (an implementation of that interface). This is useful to break direct -/// link-time dependencies between the (possibly shared) libraries in which -/// the user and the implementation live. -class CrossTUAnalysisHelper { -public: - /// Determine the original source location in the original TU for an - /// imported source location. - /// \p ToLoc Source location in the imported-to AST. - /// \return Source location in the imported-from AST and the corresponding - /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit - /// object that is returned here). - /// If any error happens (ToLoc is a non-imported source location) empty is - /// returned. - virtual llvm::Optional> - getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 0; - - virtual ~CrossTUAnalysisHelper() {} -}; -} // namespace clang - -#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H diff --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def b/clang/include/clang/Analysis/PathDiagnosticConsumers.def deleted file mode 100644 index 33d2072fcf31.. --- a/clang/include/clang/Analysis/PathDiagnosticConsumers.def +++ /dev/null @@ -1,50 +0,0 @@ -//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===//
[llvm-branch-commits] [lldb] 274afac - lldb: Add support for DW_AT_ranges on DW_TAG_subprograms
Author: David Blaikie Date: 2021-01-07T14:28:03-08:00 New Revision: 274afac9a17f43e5396a0d6c7a0741702596a7bd URL: https://github.com/llvm/llvm-project/commit/274afac9a17f43e5396a0d6c7a0741702596a7bd DIFF: https://github.com/llvm/llvm-project/commit/274afac9a17f43e5396a0d6c7a0741702596a7bd.diff LOG: lldb: Add support for DW_AT_ranges on DW_TAG_subprograms gcc already produces debug info with this form -freorder-block-and-partition clang produces this sort of thing with -fbasic-block-sections and with a coming-soon tweak to use ranges in DWARFv5 where they can allow greater reuse of debug_addr than the low/high_pc forms. This fixes the case of breaking on a function name, but leaves broken printing a variable - a follow-up commit will add that and improve the test case to match. Differential Revision: https://reviews.llvm.org/D94063 Added: lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 3eca911f4837..421298802645 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -687,13 +687,15 @@ const char *DWARFDebugInfoEntry::GetPubname(const DWARFUnit *cu) const { /// table, except that the actual DIE offset for the function is placed in the /// table instead of the compile unit offset. void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable( -const DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const { +DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const { if (m_tag) { if (m_tag == DW_TAG_subprogram) { - dw_addr_t lo_pc = LLDB_INVALID_ADDRESS; - dw_addr_t hi_pc = LLDB_INVALID_ADDRESS; - if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS)) { -debug_aranges->AppendRange(GetOffset(), lo_pc, hi_pc); + DWARFRangeList ranges; + GetAttributeAddressRanges(cu, ranges, +/*check_hi_lo_pc=*/true); + for (const auto : ranges) { +debug_aranges->AppendRange(GetOffset(), r.GetRangeBase(), + r.GetRangeEnd()); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h index 534d92e1feb9..0ba56a0a4161 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -42,7 +42,7 @@ class DWARFDebugInfoEntry { bool operator==(const DWARFDebugInfoEntry ) const; bool operator!=(const DWARFDebugInfoEntry ) const; - void BuildFunctionAddressRangeTable(const DWARFUnit *cu, + void BuildFunctionAddressRangeTable(DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const; bool Extract(const lldb_private::DWARFDataExtractor , diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s new file mode 100644 index ..1ff883c67f9e --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s @@ -0,0 +1,159 @@ + .text + .file "main.c" + .globl main# -- Begin function main + .p2align4, 0x90 + .type main,@function +main: # @main +.Lfunc_begin0: + .file 1 "/usr/local/google/home/blaikie/dev/scratch" "main.c" + .loc1 1 0 # main.c:1:0 + .cfi_startproc +# %bb.0:# %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq%rsp, %rbp + .cfi_def_cfa_register %rbp + xorl%eax, %eax +.Ltmp0: + .loc1 2 7 prologue_end # main.c:2:7 + movl$3, -4(%rbp) + .loc1 3 1 # main.c:3:1 + popq%rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp1: +.Lfunc_end0: + .size main, .Lfunc_end0-main + .cfi_endproc +# -- End function + .section.debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte
[llvm-branch-commits] [llvm] 3503c85 - Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124
Author: David Blaikie Date: 2021-01-07T14:18:19-08:00 New Revision: 3503c856819efc01ce210fa56e597ddfb7a4c1a1 URL: https://github.com/llvm/llvm-project/commit/3503c856819efc01ce210fa56e597ddfb7a4c1a1 DIFF: https://github.com/llvm/llvm-project/commit/3503c856819efc01ce210fa56e597ddfb7a4c1a1.diff LOG: Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124 Added: Modified: llvm/include/llvm/IR/ValueHandle.h llvm/unittests/IR/ValueHandleTest.cpp llvm/unittests/Support/DataExtractorTest.cpp Removed: diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h index 1324053800c7..a88b28ac7e62 100644 --- a/llvm/include/llvm/IR/ValueHandle.h +++ b/llvm/include/llvm/IR/ValueHandle.h @@ -486,7 +486,9 @@ class PoisoningVH #endif ValueTy *getValPtr() const { +#if LLVM_ENABLE_ABI_BREAKING_CHECKS assert(!Poisoned && "Accessed a poisoned value handle!"); +#endif return static_cast(getRawValPtr()); } void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); } diff --git a/llvm/unittests/IR/ValueHandleTest.cpp b/llvm/unittests/IR/ValueHandleTest.cpp index 1aed8e1a1ee7..8eb6b5f89a40 100644 --- a/llvm/unittests/IR/ValueHandleTest.cpp +++ b/llvm/unittests/IR/ValueHandleTest.cpp @@ -186,7 +186,7 @@ TEST_F(ValueHandle, AssertingVH_ReducesToPointer) { EXPECT_EQ(sizeof(CastInst *), sizeof(AssertingVH)); } -#else // !NDEBUG +#elif LLVM_ENABLE_ABI_BREAKING_CHECKS // && !NDEBUG #ifdef GTEST_HAS_DEATH_TEST @@ -530,6 +530,7 @@ TEST_F(ValueHandle, TrackingVH_Tracks) { } #ifdef GTEST_HAS_DEATH_TEST +#if LLVM_ENABLE_ABI_BREAKING_CHECKS TEST_F(ValueHandle, PoisoningVH_Asserts) { PoisoningVH VH(BitcastV.get()); @@ -549,6 +550,8 @@ TEST_F(ValueHandle, PoisoningVH_Asserts) { // Don't clear anything out here as destroying the handles should be fine. } +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + TEST_F(ValueHandle, TrackingVH_Asserts) { { TrackingVH VH(BitcastV.get()); diff --git a/llvm/unittests/Support/DataExtractorTest.cpp b/llvm/unittests/Support/DataExtractorTest.cpp index 278e5885916c..41c40648b85e 100644 --- a/llvm/unittests/Support/DataExtractorTest.cpp +++ b/llvm/unittests/Support/DataExtractorTest.cpp @@ -214,7 +214,8 @@ TEST(DataExtractorTest, Cursor_chaining) { EXPECT_THAT_ERROR(C.takeError(), Succeeded()); } -#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) +#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) && \ +LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(DataExtractorDeathTest, Cursor) { DataExtractor DE(StringRef("AB"), false, 8); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ad18b07 - DebugInfo: Add support for always using ranges (rather than low/high pc) in DWARFv5
Author: David Blaikie Date: 2021-01-05T16:36:22-08:00 New Revision: ad18b075fd63935148b460f9c6b4dce130c56b15 URL: https://github.com/llvm/llvm-project/commit/ad18b075fd63935148b460f9c6b4dce130c56b15 DIFF: https://github.com/llvm/llvm-project/commit/ad18b075fd63935148b460f9c6b4dce130c56b15.diff LOG: DebugInfo: Add support for always using ranges (rather than low/high pc) in DWARFv5 Given the ability provided by DWARFv5 rnglists to reuse addresses in the address pool, it can be advantageous to object file size to use range encodings even when the range could be described by a direct low/high pc. Add a flag to allow enabling this in DWARFv5 for the purpose of experimentation/data gathering. It might be that it makes sense to enable this functionality by default for DWARFv5 + Split DWARF at least, where the tradeoff/desire to optimize for .o file size is more explicit and .o bytes are higher priority than .dwo bytes. Added: llvm/test/DebugInfo/X86/ranges_always.ll Modified: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h Removed: diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 7cf2b566ede8..02791f2280d2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -558,7 +558,12 @@ void DwarfCompileUnit::addScopeRangeList(DIE , void DwarfCompileUnit::attachRangesOrLowHighPC( DIE , SmallVector Ranges) { - if (Ranges.size() == 1 || !DD->useRangesSection()) { + assert(!Ranges.empty()); + if (!DD->useRangesSection() || + (Ranges.size() == 1 && + (!DD->alwaysUseRanges() || +DD->getSectionLabel(().Begin->getSection()) == +Ranges.front().Begin))) { const RangeSpan = Ranges.front(); const RangeSpan = Ranges.back(); attachLowHighPC(Die, Front.Begin, Back.End); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b790434576cb..fa5d55071e17 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -151,6 +151,14 @@ static cl::opt "Abstract subprograms")), cl::init(DefaultLinkageNames)); +static cl::opt AlwaysUseRangesInV5( +"always-use-ranges-in-v5", cl::Hidden, +cl::desc("Always use DW_AT_ranges in DWARFv5 whenever it could allow more " + "address pool entry sharing to reduce relocations/object size"), +cl::values(clEnumVal(Default, "Default for platform"), + clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), +cl::init(Default)); + static constexpr unsigned ULEB128PadSize = 4; void DebugLocDwarfExpression::emitOp(uint8_t Op, const char *Comment) { @@ -422,6 +430,19 @@ DwarfDebug::DwarfDebug(AsmPrinter *A) else EnableOpConvert = (DwarfOpConvert == Enable); + // Split DWARF would benefit object size significantly by trading reductions + // in address pool usage for slightly increased range list encodings. + if (DwarfVersion >= 5) { +if (AlwaysUseRangesInV5 == Default) { + // FIXME: In the future, enable this by default for Split DWARF where the + // tradeoff is more pronounced due to being able to offload the range + // lists to the dwo file and shrink object files/reduce relocations there. + AlwaysUseRanges = false; +} else { + AlwaysUseRanges = AlwaysUseRangesInV5 == Enable; +} + } + Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion); Asm->OutStreamer->getContext().setDwarfFormat(Dwarf64 ? dwarf::DWARF64 : dwarf::DWARF32); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 502aef481a3a..b3b8e62fb5d9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -378,6 +378,9 @@ class DwarfDebug : public DebugHandlerBase { /// Avoid using DW_OP_convert due to consumer incompatibilities. bool EnableOpConvert; + /// Force the use of DW_AT_ranges even for single-entry range lists. + bool AlwaysUseRanges = false; + /// DWARF5 Experimental Options /// @{ AccelTableKind TheAccelTableKind; @@ -689,6 +692,10 @@ class DwarfDebug : public DebugHandlerBase { /// Returns whether ranges section should be emitted. bool useRangesSection() const { return UseRangesSection; } + /// Returns whether range encodings should be used for single entry range + /// lists. + bool alwaysUseRanges() const { return AlwaysUseRanges; } + /// Returns whether to use sections as labels rather than temp symbols. bool useSectionsAsReferences() const { return UseSectionsAsReferences;
[llvm-branch-commits] [llvm] 4415678 - Fix shtest-timeout test harder
Author: David Blaikie Date: 2020-12-08T00:23:33-08:00 New Revision: 4415678718ad471c84f024e20ce864ae1e79348a URL: https://github.com/llvm/llvm-project/commit/4415678718ad471c84f024e20ce864ae1e79348a DIFF: https://github.com/llvm/llvm-project/commit/4415678718ad471c84f024e20ce864ae1e79348a.diff LOG: Fix shtest-timeout test harder Don't produce or expect any output from the infinite looping test - doing so is a recipe for racey flakyness without a longer timeout to ensure the output is received first, even though that doesn't seem integral/important to the test. Instead have a plain, no output infinite loop and check that that is caught and handled. If for some reason the output is valuable for test coverage - the timeout should be increased from 1 second to give the process time to output the text, flush, and for that text to be received and buffered before the test is timed out. Added: Modified: llvm/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py llvm/utils/lit/tests/shtest-timeout.py Removed: diff --git a/llvm/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py b/llvm/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py index c8ced24f29c5..079f3595e175 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py +++ b/llvm/utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py @@ -1,9 +1,3 @@ # RUN: %{python} %s -from __future__ import print_function - -import sys - -print("Running infinite loop") -sys.stdout.flush() # Make sure the print gets flushed so it appears in lit output. while True: pass diff --git a/llvm/utils/lit/tests/shtest-timeout.py b/llvm/utils/lit/tests/shtest-timeout.py index f229c286088b..1576b89ea182 100644 --- a/llvm/utils/lit/tests/shtest-timeout.py +++ b/llvm/utils/lit/tests/shtest-timeout.py @@ -25,7 +25,6 @@ # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py -# CHECK-INTSH-OUT: command output: # CHECK-INTSH-OUT: command reached timeout: True # CHECK-INTSH-ERR: Using internal shell ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] c4af1c8 - PR48383: Disallow decltype(auto) in pseudodestructor calls
Author: David Blaikie Date: 2020-12-03T20:41:06-08:00 New Revision: c4af1c8d939b21ac7deb631887fc26db7451c592 URL: https://github.com/llvm/llvm-project/commit/c4af1c8d939b21ac7deb631887fc26db7451c592 DIFF: https://github.com/llvm/llvm-project/commit/c4af1c8d939b21ac7deb631887fc26db7451c592.diff LOG: PR48383: Disallow decltype(auto) in pseudodestructor calls Added: Modified: clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaCXX/cxx1y-deduced-return-type.cpp Removed: diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index e36d9adfbaba..241b8f72c56e 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -7595,6 +7595,11 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, if (CheckArrow(*this, ObjectType, Base, OpKind, OpLoc)) return ExprError(); + if (DS.getTypeSpecType() == DeclSpec::TST_decltype_auto) { +Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid); +return true; + } + QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc(), false); diff --git a/clang/test/SemaCXX/cxx1y-deduced-return-type.cpp b/clang/test/SemaCXX/cxx1y-deduced-return-type.cpp index 3e544c300884..051b0e7b1469 100644 --- a/clang/test/SemaCXX/cxx1y-deduced-return-type.cpp +++ b/clang/test/SemaCXX/cxx1y-deduced-return-type.cpp @@ -421,6 +421,7 @@ namespace DecltypeAutoShouldNotBeADecltypeSpecifier { namespace Dtor { struct A {}; void f(A a) { a.~decltype(auto)(); } // expected-error {{'decltype(auto)' not allowed here}} +void g(int i) { i.~decltype(auto)(); } // expected-error {{'decltype(auto)' not allowed here}} } namespace BaseClass { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] c98a7ab - IntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase copy construction
Author: David Blaikie Date: 2020-12-03T18:43:01-08:00 New Revision: c98a7ab1b1d647492554872e395b2ae5763fd23e URL: https://github.com/llvm/llvm-project/commit/c98a7ab1b1d647492554872e395b2ae5763fd23e DIFF: https://github.com/llvm/llvm-project/commit/c98a7ab1b1d647492554872e395b2ae5763fd23e.diff LOG: IntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase copy construction Post commit feedback on 2e83ccc2ee33 from Nathan James! Added: Modified: llvm/include/llvm/ADT/IntrusiveRefCntPtr.h Removed: diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h index 42486d1616a8..41e5e6b9f8ed 100644 --- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -86,10 +86,10 @@ template class RefCountedBase { /// A thread-safe version of \c RefCountedBase. template class ThreadSafeRefCountedBase { - mutable std::atomic RefCount; + mutable std::atomic RefCount{0}; protected: - ThreadSafeRefCountedBase() : RefCount(0) {} + ThreadSafeRefCountedBase() = default; ThreadSafeRefCountedBase(const ThreadSafeRefCountedBase &) {} ThreadSafeRefCountedBase & operator=(const ThreadSafeRefCountedBase &) = delete; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 2e83ccc - ADT: Support copying of IntrusiveRefCntPtr objects
Author: David Blaikie Date: 2020-12-03T17:42:32-08:00 New Revision: 2e83ccc2ee89110659f3cb313968a0c970d4 URL: https://github.com/llvm/llvm-project/commit/2e83ccc2ee89110659f3cb313968a0c970d4 DIFF: https://github.com/llvm/llvm-project/commit/2e83ccc2ee89110659f3cb313968a0c970d4.diff LOG: ADT: Support copying of IntrusiveRefCntPtr objects This was partially supported but untested for RefCountedBase (the implicit copy assignment would've been problematic - so delete that) and unsupported (would not have compiled, because std::atomic is non-copyable) for ThreadSafeRefCountedBase (implement similar support to RefCountedBase) Fix the test that had a copy ctor for the derived object but called RefCountBase's default ctor from that copy ctor - which meant it wasn't actually testing RefCountBase's copy semantics. Added: Modified: llvm/include/llvm/ADT/IntrusiveRefCntPtr.h llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp Removed: diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h index 6d97fe15db8b..42486d1616a8 100644 --- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -73,6 +73,7 @@ template class RefCountedBase { public: RefCountedBase() = default; RefCountedBase(const RefCountedBase &) {} + RefCountedBase =(const RefCountedBase &) = delete; void Retain() const { ++RefCount; } @@ -89,6 +90,9 @@ template class ThreadSafeRefCountedBase { protected: ThreadSafeRefCountedBase() : RefCount(0) {} + ThreadSafeRefCountedBase(const ThreadSafeRefCountedBase &) {} + ThreadSafeRefCountedBase & + operator=(const ThreadSafeRefCountedBase &) = delete; public: void Retain() const { RefCount.fetch_add(1, std::memory_order_relaxed); } diff --git a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp index c248b04ed5a2..3d8041fcbf48 100644 --- a/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp +++ b/llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp @@ -12,28 +12,34 @@ namespace llvm { namespace { -struct SimpleRefCounted : public RefCountedBase { +int NumInstances = 0; +template class Base> +struct SimpleRefCounted : Base> { SimpleRefCounted() { ++NumInstances; } - SimpleRefCounted(const SimpleRefCounted &) : RefCountedBase() { + SimpleRefCounted(const SimpleRefCounted ) : Base(RHS) { ++NumInstances; } ~SimpleRefCounted() { --NumInstances; } - - static int NumInstances; }; -int SimpleRefCounted::NumInstances = 0; } // anonymous namespace -TEST(IntrusiveRefCntPtr, RefCountedBaseCopyDoesNotLeak) { - EXPECT_EQ(0, SimpleRefCounted::NumInstances); +template struct IntrusiveRefCntPtrTest : testing::Test {}; + +typedef ::testing::Types, + SimpleRefCounted> +IntrusiveRefCntTypes; +TYPED_TEST_CASE(IntrusiveRefCntPtrTest, IntrusiveRefCntTypes); + +TYPED_TEST(IntrusiveRefCntPtrTest, RefCountedBaseCopyDoesNotLeak) { + EXPECT_EQ(0, NumInstances); { -SimpleRefCounted *S1 = new SimpleRefCounted; -IntrusiveRefCntPtr R1 = S1; -SimpleRefCounted *S2 = new SimpleRefCounted(*S1); -IntrusiveRefCntPtr R2 = S2; -EXPECT_EQ(2, SimpleRefCounted::NumInstances); +TypeParam *S1 = new TypeParam; +IntrusiveRefCntPtr R1 = S1; +TypeParam *S2 = new TypeParam(*S1); +IntrusiveRefCntPtr R2 = S2; +EXPECT_EQ(2, NumInstances); } - EXPECT_EQ(0, SimpleRefCounted::NumInstances); + EXPECT_EQ(0, NumInstances); } struct InterceptRefCounted : public RefCountedBase { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 0fd0f88 - [mlir] Use long rather than int to address pointer-to-int narrowing warning
Author: David Blaikie Date: 2020-12-03T13:09:36-08:00 New Revision: 0fd0f885eb990feecd67749eff79a5a821767d84 URL: https://github.com/llvm/llvm-project/commit/0fd0f885eb990feecd67749eff79a5a821767d84 DIFF: https://github.com/llvm/llvm-project/commit/0fd0f885eb990feecd67749eff79a5a821767d84.diff LOG: [mlir] Use long rather than int to address pointer-to-int narrowing warning Added: Modified: mlir/test/CAPI/ir.c Removed: diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c index afada8ade70d..396984690e02 100644 --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -1280,19 +1280,19 @@ int registerOnlyStd() { // Wraps a diagnostic into additional text we can match against. MlirLogicalResult errorHandler(MlirDiagnostic diagnostic, void *userData) { - fprintf(stderr, "processing diagnostic (userData: %d) <<\n", (int)userData); + fprintf(stderr, "processing diagnostic (userData: %ld) <<\n", (long)userData); mlirDiagnosticPrint(diagnostic, printToStderr, NULL); fprintf(stderr, "\n"); MlirLocation loc = mlirDiagnosticGetLocation(diagnostic); mlirLocationPrint(loc, printToStderr, NULL); assert(mlirDiagnosticGetNumNotes(diagnostic) == 0); - fprintf(stderr, ">> end of diagnostic (userData: %d)\n", (int)userData); + fprintf(stderr, ">> end of diagnostic (userData: %ld)\n", (long)userData); return mlirLogicalResultSuccess(); } // Logs when the delete user data callback is called static void deleteUserData(void *userData) { - fprintf(stderr, "deleting user data (userData: %d)\n", (int)userData); + fprintf(stderr, "deleting user data (userData: %ld)\n", (long)userData); } void testDiagnostics() { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 30b1ae5 - [mlir] Make conversion functions inline instead of static to avoid -Wunused-function
Author: David Blaikie Date: 2020-12-03T13:09:36-08:00 New Revision: 30b1ae591657a14292f2134b426559c3aa6a289d URL: https://github.com/llvm/llvm-project/commit/30b1ae591657a14292f2134b426559c3aa6a289d DIFF: https://github.com/llvm/llvm-project/commit/30b1ae591657a14292f2134b426559c3aa6a289d.diff LOG: [mlir] Make conversion functions inline instead of static to avoid -Wunused-function Added: Modified: mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp Removed: diff --git a/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp b/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp index f62e7aebe24a..f748b56b1bdf 100644 --- a/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp +++ b/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp @@ -250,7 +250,7 @@ static void emitOneEnumFromConversion(const llvm::Record *record, StringRef cppNamespace = enumAttr.getCppNamespace(); // Emit the function converting the enum attribute from its LLVM counterpart. - os << formatv("static {0}::{1} convert{1}FromLLVM({2} value) {{\n", + os << formatv("inline {0}::{1} convert{1}FromLLVM({2} value) {{\n", cppNamespace, cppClassName, llvmClass); os << " switch (value) {\n"; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 78b0ec3 - Avoid redundant inline with LLVM_ATTRIBUTE_ALWAYS_INLINE
Author: James Park Date: 2020-12-01T14:43:16-08:00 New Revision: 78b0ec3d1c5cc198093bb03ecb86bca25fe570ca URL: https://github.com/llvm/llvm-project/commit/78b0ec3d1c5cc198093bb03ecb86bca25fe570ca DIFF: https://github.com/llvm/llvm-project/commit/78b0ec3d1c5cc198093bb03ecb86bca25fe570ca.diff LOG: Avoid redundant inline with LLVM_ATTRIBUTE_ALWAYS_INLINE Fix MSVC warning when __forceinline is paired with inline. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D85264 Added: Modified: llvm/include/llvm/IR/User.h llvm/include/llvm/Support/Compiler.h llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Removed: diff --git a/llvm/include/llvm/IR/User.h b/llvm/include/llvm/IR/User.h index ebfae1db2980..221bb5b2cb1c 100644 --- a/llvm/include/llvm/IR/User.h +++ b/llvm/include/llvm/IR/User.h @@ -45,7 +45,7 @@ class User : public Value { template friend struct HungoffOperandTraits; - LLVM_ATTRIBUTE_ALWAYS_INLINE inline static void * + LLVM_ATTRIBUTE_ALWAYS_INLINE static void * allocateFixedOperandUser(size_t, unsigned, unsigned); protected: diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index d7001a5c289a..a9e4f7f8353d 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -234,11 +234,11 @@ /// 3.4 supported this but is buggy in various cases and produces unimplemented /// errors, just use it in GCC 4.0 and later. #if __has_attribute(always_inline) || LLVM_GNUC_PREREQ(4, 0, 0) -#define LLVM_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) +#define LLVM_ATTRIBUTE_ALWAYS_INLINE inline __attribute__((always_inline)) #elif defined(_MSC_VER) #define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline #else -#define LLVM_ATTRIBUTE_ALWAYS_INLINE +#define LLVM_ATTRIBUTE_ALWAYS_INLINE inline #endif #ifdef __GNUC__ diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 6c73842414cb..43dbc3df16df 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2294,7 +2294,7 @@ void SelectionDAGISel::Select_FREEZE(SDNode *N) { } /// GetVBR - decode a vbr encoding whose top bit is set. -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline uint64_t +LLVM_ATTRIBUTE_ALWAYS_INLINE static uint64_t GetVBR(uint64_t Val, const unsigned char *MatcherTable, unsigned ) { assert(Val >= 128 && "Not a VBR"); Val &= 127; // Remove first vbr bit. @@ -2491,10 +2491,9 @@ MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList, } /// CheckSame - Implements OP_CheckSame. -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool -CheckSame(const unsigned char *MatcherTable, unsigned , - SDValue N, - const SmallVectorImpl> ) { +LLVM_ATTRIBUTE_ALWAYS_INLINE static bool +CheckSame(const unsigned char *MatcherTable, unsigned , SDValue N, + const SmallVectorImpl> ) { // Accept if it is exactly the same as a previously recorded node. unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckSame"); @@ -2502,11 +2501,10 @@ CheckSame(const unsigned char *MatcherTable, unsigned , } /// CheckChildSame - Implements OP_CheckChildXSame. -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool -CheckChildSame(const unsigned char *MatcherTable, unsigned , - SDValue N, - const SmallVectorImpl> , - unsigned ChildNo) { +LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckChildSame( +const unsigned char *MatcherTable, unsigned , SDValue N, +const SmallVectorImpl> , +unsigned ChildNo) { if (ChildNo >= N.getNumOperands()) return false; // Match fails if out of range child #. return ::CheckSame(MatcherTable, MatcherIndex, N.getOperand(ChildNo), @@ -2514,20 +2512,20 @@ CheckChildSame(const unsigned char *MatcherTable, unsigned , } /// CheckPatternPredicate - Implements OP_CheckPatternPredicate. -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool +LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckPatternPredicate(const unsigned char *MatcherTable, unsigned , const SelectionDAGISel ) { return SDISel.CheckPatternPredicate(MatcherTable[MatcherIndex++]); } /// CheckNodePredicate - Implements OP_CheckNodePredicate. -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool +LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckNodePredicate(const unsigned char *MatcherTable, unsigned , const SelectionDAGISel , SDNode *N) { return SDISel.CheckNodePredicate(N, MatcherTable[MatcherIndex++]); } -LLVM_ATTRIBUTE_ALWAYS_INLINE static inline bool +LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckOpcode(const unsigned char *MatcherTable, unsigned , SDNode *N) { uint16_t Opc = MatcherTable[MatcherIndex++]; @@ -2535,7 +2533,7 @@
[llvm-branch-commits] [llvm] 175ebad - DebugInfo: remove unnecessary mtriple from test/DebugInfo/X86/abstract_origin.ll
Author: David Blaikie Date: 2020-11-25T13:34:15-08:00 New Revision: 175ebad958a0ebaf6c56c20ab30b9d4347742c29 URL: https://github.com/llvm/llvm-project/commit/175ebad958a0ebaf6c56c20ab30b9d4347742c29 DIFF: https://github.com/llvm/llvm-project/commit/175ebad958a0ebaf6c56c20ab30b9d4347742c29.diff LOG: DebugInfo: remove unnecessary mtriple from test/DebugInfo/X86/abstract_origin.ll The test already specifies a triple in the IR itself. Based on post-commit feedback from Luís Marques. Added: Modified: llvm/test/DebugInfo/X86/abstract_origin.ll Removed: diff --git a/llvm/test/DebugInfo/X86/abstract_origin.ll b/llvm/test/DebugInfo/X86/abstract_origin.ll index 4cf49055cbd8..a9eb970cfb62 100644 --- a/llvm/test/DebugInfo/X86/abstract_origin.ll +++ b/llvm/test/DebugInfo/X86/abstract_origin.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64 -filetype=obj %s -o - | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -debug-info - | FileCheck %s ; Generated at -O2 from: ; void f(); ; __attribute__((always_inline)) void g() { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 01cee92 - DebugInfo: Remove llc_dwarf usage from tests already relying on a target triple in the IR
Author: David Blaikie Date: 2020-11-24T17:48:11-08:00 New Revision: 01cee921abe924ae98027ce599d3c76ca5780a38 URL: https://github.com/llvm/llvm-project/commit/01cee921abe924ae98027ce599d3c76ca5780a38 DIFF: https://github.com/llvm/llvm-project/commit/01cee921abe924ae98027ce599d3c76ca5780a38.diff LOG: DebugInfo: Remove llc_dwarf usage from tests already relying on a target triple in the IR Added: Modified: llvm/test/DebugInfo/X86/DIModuleContext.ll llvm/test/DebugInfo/X86/Fortran-DIModule.ll llvm/test/DebugInfo/X86/align_c11.ll llvm/test/DebugInfo/X86/align_cpp11.ll llvm/test/DebugInfo/X86/align_objc.ll llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll llvm/test/DebugInfo/X86/atomic-c11-dwarf-5.ll llvm/test/DebugInfo/X86/constant-loclist.ll llvm/test/DebugInfo/X86/containing-type-extension-rust.ll llvm/test/DebugInfo/X86/debug-info-auto-return.ll llvm/test/DebugInfo/X86/debug-info-packed-struct.ll llvm/test/DebugInfo/X86/debug-info-template-parameter.ll llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll llvm/test/DebugInfo/X86/debug-macro-dwo.ll llvm/test/DebugInfo/X86/debug-macro-gnu-dwo.ll llvm/test/DebugInfo/X86/debug-macro-gnu.ll llvm/test/DebugInfo/X86/debug-macro-v5.ll llvm/test/DebugInfo/X86/distringtype.ll llvm/test/DebugInfo/X86/gmlt-no-split-dwarf-inlining-empty.ll llvm/test/DebugInfo/X86/inline-namespace.ll llvm/test/DebugInfo/X86/noreturn_c11.ll llvm/test/DebugInfo/X86/noreturn_cpp11.ll llvm/test/DebugInfo/X86/noreturn_objc.ll llvm/test/DebugInfo/X86/partial-constant.ll llvm/test/DebugInfo/X86/single-dbg_value.ll llvm/test/DebugInfo/X86/split-dwarf-multiple-cu-hash.ll llvm/test/DebugInfo/X86/split-dwarf-omit-empty.ll llvm/test/DebugInfo/X86/split-dwarf-sysroot.ll llvm/test/DebugInfo/X86/static_member_array.ll llvm/test/DebugInfo/X86/unattached-global.ll Removed: diff --git a/llvm/test/DebugInfo/X86/DIModuleContext.ll b/llvm/test/DebugInfo/X86/DIModuleContext.ll index e9dd9116b393..aee57033f431 100644 --- a/llvm/test/DebugInfo/X86/DIModuleContext.ll +++ b/llvm/test/DebugInfo/X86/DIModuleContext.ll @@ -1,6 +1,6 @@ source_filename = "test/DebugInfo/X86/DIModuleContext.ll" target triple = "x86_64-apple-macosx" -; RUN: %llc_dwarf %s -o - -filetype=obj \ +; RUN: llc %s -o - -filetype=obj \ ; RUN: | llvm-dwarfdump -debug-info - | FileCheck %s ; CHECK: DW_TAG_module ; CHECK-NOT: NULL diff --git a/llvm/test/DebugInfo/X86/Fortran-DIModule.ll b/llvm/test/DebugInfo/X86/Fortran-DIModule.ll index 37c46d1d02e8..39ada5e42f40 100644 --- a/llvm/test/DebugInfo/X86/Fortran-DIModule.ll +++ b/llvm/test/DebugInfo/X86/Fortran-DIModule.ll @@ -1,5 +1,5 @@ ; This test checks attributes of a Fortran module. -; RUN: %llc_dwarf %s -filetype=obj -o - | \ +; RUN: llc %s -filetype=obj -o - | \ ; RUN: llvm-dwarfdump - | FileCheck %s ; CHECK: DW_TAG_module diff --git a/llvm/test/DebugInfo/X86/align_c11.ll b/llvm/test/DebugInfo/X86/align_c11.ll index cc0383a8ca93..baadca1ba6a4 100644 --- a/llvm/test/DebugInfo/X86/align_c11.ll +++ b/llvm/test/DebugInfo/X86/align_c11.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source ; diff --git a/llvm/test/DebugInfo/X86/align_cpp11.ll b/llvm/test/DebugInfo/X86/align_cpp11.ll index 92dfdaee5390..10116e3c6a89 100644 --- a/llvm/test/DebugInfo/X86/align_cpp11.ll +++ b/llvm/test/DebugInfo/X86/align_cpp11.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s ; Generated by clang++ -c -g -std=c++11 -S -emit-llvm from the following C++11 source ; struct S { diff --git a/llvm/test/DebugInfo/X86/align_objc.ll b/llvm/test/DebugInfo/X86/align_objc.ll index 9ce6dea0a41d..13bbf862e9b1 100644 --- a/llvm/test/DebugInfo/X86/align_objc.ll +++ b/llvm/test/DebugInfo/X86/align_objc.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s ; typedef struct __attribute__((aligned (128))) { ; char c; diff --git a/llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll b/llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll index c31b7d168c45..820182d9031f 100644 --- a/llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll +++ b/llvm/test/DebugInfo/X86/atomic-c11-dwarf-4.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source ;
[llvm-branch-commits] [llvm] cbd7541 - DebugInfo: Add some missing explicit target triples.
Author: David Blaikie Date: 2020-11-24T17:35:00-08:00 New Revision: cbd754163934a64e65b87a0f1b2c6741af8d24db URL: https://github.com/llvm/llvm-project/commit/cbd754163934a64e65b87a0f1b2c6741af8d24db DIFF: https://github.com/llvm/llvm-project/commit/cbd754163934a64e65b87a0f1b2c6741af8d24db.diff LOG: DebugInfo: Add some missing explicit target triples. Based on D91043 by Luís Marques. Thanks Luís! Differential Revision: https://reviews.llvm.org/D91043 Added: Modified: llvm/test/DebugInfo/X86/abstract_origin.ll llvm/test/DebugInfo/X86/convert-debugloc.ll llvm/test/DebugInfo/X86/convert-inlined.ll llvm/test/DebugInfo/X86/convert-linked.ll llvm/test/DebugInfo/X86/convert-loclist.ll llvm/test/DebugInfo/X86/dbg-byval-parameter.ll llvm/test/DebugInfo/X86/debug-macro.ll llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs.ll Removed: diff --git a/llvm/test/DebugInfo/X86/abstract_origin.ll b/llvm/test/DebugInfo/X86/abstract_origin.ll index 36992177e341..4cf49055cbd8 100644 --- a/llvm/test/DebugInfo/X86/abstract_origin.ll +++ b/llvm/test/DebugInfo/X86/abstract_origin.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -filetype=obj %s -o - | llvm-dwarfdump -debug-info - | FileCheck %s +; RUN: llc -mtriple=x86_64 -filetype=obj %s -o - | llvm-dwarfdump -debug-info - | FileCheck %s ; Generated at -O2 from: ; void f(); ; __attribute__((always_inline)) void g() { diff --git a/llvm/test/DebugInfo/X86/convert-debugloc.ll b/llvm/test/DebugInfo/X86/convert-debugloc.ll index a61127ab6932..fc31c3f72549 100644 --- a/llvm/test/DebugInfo/X86/convert-debugloc.ll +++ b/llvm/test/DebugInfo/X86/convert-debugloc.ll @@ -1,4 +1,4 @@ -; RUN: %llc_dwarf -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}" ; Test lldb default: OP_convert is unsupported when using MachO @@ -8,13 +8,13 @@ ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}" ; Test gdb default: OP_convert is only disabled in split DWARF -; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}" ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -split-dwarf-file=baz.dwo | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=NOCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}" ; Test the ability to override the platform default in either direction -; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -dwarf-op-convert=Disable | llvm-dwarfdump - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -dwarf-op-convert=Disable | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}" ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}" @@ -23,7 +23,7 @@ ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable -split-dwarf-file=baz.dwo | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=CONV --check-prefix=SPLITCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}" -; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump -v -debug-info - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump -v -debug-info - \ ; RUN: | FileCheck %s --check-prefix=VERBOSE --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}" diff --git a/llvm/test/DebugInfo/X86/convert-inlined.ll b/llvm/test/DebugInfo/X86/convert-inlined.ll index 5e28a7293d80..14f9a8a3e26e 100644 --- a/llvm/test/DebugInfo/X86/convert-inlined.ll +++ b/llvm/test/DebugInfo/X86/convert-inlined.ll @@ -1,6 +1,6 @@ -; RUN: %llc_dwarf -dwarf-version=5 -filetype=obj -O0 < %s | llvm-dwarfdump - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=DW5 "--implicit-check-not={{DW_TAG|NULL}}" -; RUN: %llc_dwarf -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \ +; RUN: llc -mtriple=x86_64 -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \ ; RUN: | FileCheck %s --check-prefix=DW4 "--implicit-check-not={{DW_TAG|NULL}}" ; DW5: .debug_info contents: diff --git