Skip to content

Commit

Permalink
[NFC][RemoveDIs] Remove conditional compilation for RemoveDIs (llvm#8…
Browse files Browse the repository at this point in the history
…1149)

A colleague observes that switching the default value of
LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS to "On" hasn't flipped the value
in their CMakeCache.txt. This probably means that everyone with an
existing build tree is going to not have support built in, meaning
everyone in LLVM would need to clean+rebuild their worktree when we flip
the switch on... which doesn't sound good.

So instead, just delete the flag and everything it does, making everyone
build and run ~400 lit tests in RemoveDIs mode. None of the buildbots
have had trouble with this, so it Should Be Fine (TM).

(Sending for review as this is changing various comments, and touches
several different areas -- I don't want to get too punchy).
  • Loading branch information
jmorse authored Feb 8, 2024
1 parent 067d277 commit 92eaf03
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 88 deletions.
3 changes: 0 additions & 3 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,6 @@ option(LLVM_USE_OPROFILE
option(LLVM_EXTERNALIZE_DEBUGINFO
"Generate dSYM files and strip executables and libraries (Darwin Only)" OFF)

option(LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS
"Add extra Booleans to ilist_iterators to communicate facts for debug-info" ON)

set(LLVM_CODESIGNING_IDENTITY "" CACHE STRING
"Sign executables and dylibs with the given identity or skip if empty (Darwin Only)")

Expand Down
4 changes: 0 additions & 4 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ if(LLVM_ENABLE_EXPENSIVE_CHECKS)
endif()
endif()

if(LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS)
add_compile_definitions(EXPERIMENTAL_DEBUGINFO_ITERATORS)
endif()

if (LLVM_ENABLE_STRICT_FIXED_SIZE_VECTORS)
add_compile_definitions(STRICT_FIXED_SIZE_VECTORS)
endif()
Expand Down
23 changes: 0 additions & 23 deletions llvm/include/llvm/ADT/ilist_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,12 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {

node_pointer NodePtr = nullptr;

#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// (Default: Off) Allow extra position-information flags to be stored
// in iterators, in aid of removing debug-info intrinsics from LLVM.

/// Is this position intended to contain any debug-info immediately before
/// the position?
mutable bool HeadInclusiveBit = false;
/// Is this position intended to contain any debug-info immediately after
/// the position?
mutable bool TailInclusiveBit = false;
#endif

public:
/// Create from an ilist_node.
Expand All @@ -231,10 +226,8 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {
const ilist_iterator_w_bits<OptionsT, IsReverse, RHSIsConst> &RHS,
std::enable_if_t<IsConst || !RHSIsConst, void *> = nullptr)
: NodePtr(RHS.NodePtr) {
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
HeadInclusiveBit = RHS.HeadInclusiveBit;
TailInclusiveBit = RHS.TailInclusiveBit;
#endif
}

// This is templated so that we can allow assigning to a const iterator from
Expand All @@ -243,10 +236,8 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {
std::enable_if_t<IsConst || !RHSIsConst, ilist_iterator_w_bits &>
operator=(const ilist_iterator_w_bits<OptionsT, IsReverse, RHSIsConst> &RHS) {
NodePtr = RHS.NodePtr;
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
HeadInclusiveBit = RHS.HeadInclusiveBit;
TailInclusiveBit = RHS.TailInclusiveBit;
#endif
return *this;
}

Expand Down Expand Up @@ -280,10 +271,8 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {
const_cast<typename ilist_iterator_w_bits<OptionsT, IsReverse,
false>::node_reference>(
*NodePtr));
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
New.HeadInclusiveBit = HeadInclusiveBit;
New.TailInclusiveBit = TailInclusiveBit;
#endif
return New;
}
return ilist_iterator_w_bits<OptionsT, IsReverse, false>();
Expand All @@ -309,18 +298,14 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {
// Increment and decrement operators...
ilist_iterator_w_bits &operator--() {
NodePtr = IsReverse ? NodePtr->getNext() : NodePtr->getPrev();
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
HeadInclusiveBit = false;
TailInclusiveBit = false;
#endif
return *this;
}
ilist_iterator_w_bits &operator++() {
NodePtr = IsReverse ? NodePtr->getPrev() : NodePtr->getNext();
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
HeadInclusiveBit = false;
TailInclusiveBit = false;
#endif
return *this;
}
ilist_iterator_w_bits operator--(int) {
Expand All @@ -340,18 +325,10 @@ class ilist_iterator_w_bits : ilist_detail::SpecificNodeAccess<OptionsT> {
/// Check for end. Only valid if ilist_sentinel_tracking<true>.
bool isEnd() const { return NodePtr ? NodePtr->isSentinel() : false; }

#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
bool getHeadBit() const { return HeadInclusiveBit; }
bool getTailBit() const { return TailInclusiveBit; }
void setHeadBit(bool SetBit) const { HeadInclusiveBit = SetBit; }
void setTailBit(bool SetBit) const { TailInclusiveBit = SetBit; }
#else
// Store and return no information if we're not using this feature.
bool getHeadBit() const { return false; }
bool getTailBit() const { return false; }
void setHeadBit(bool SetBit) const { (void)SetBit; }
void setTailBit(bool SetBit) const { (void)SetBit; }
#endif
};

template <typename From> struct simplify_type;
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/llc/llc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,11 @@ int main(int argc, char **argv) {
}

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

if (TimeTrace)
timeTraceProfilerInitialize(TimeTraceGranularity, argv[0]);
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/llvm-link/llvm-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,11 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

LLVMContext Context;
Context.setDiagnosticHandler(std::make_unique<LLVMLinkDiagnosticHandler>(),
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/llvm-lto/llvm-lto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,15 +945,11 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm LTO linker\n");

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

if (OptLevel < '0' || OptLevel > '3')
error("optimization level must be between 0 and 3");
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/llvm-lto2/llvm-lto2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,11 @@ static int run(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "Resolution-based LTO test harness");

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

// FIXME: Workaround PR30396 which means that a symbol can appear
// more than once if it is defined in module-level assembly and
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/llvm-reduce/llvm-reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,11 @@ int main(int Argc, char **Argv) {
cl::ParseCommandLineOptions(Argc, Argv, "LLVM automatic testcase reducer.\n");

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

if (Argc == 1) {
cl::PrintHelpMessage();
Expand Down
8 changes: 2 additions & 6 deletions llvm/tools/opt/optdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,11 @@ extern "C" int optMain(
argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n");

// RemoveDIs debug-info transition: tests may request that we /try/ to use the
// new debug-info format, if it's built in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// new debug-info format.
if (TryUseNewDbgInfoFormat) {
// If LLVM was built with support for this, turn the new debug-info format
// on.
// Turn the new debug-info format on.
UseNewDbgInfoFormat = true;
}
#endif
(void)TryUseNewDbgInfoFormat;

LLVMContext Context;

Expand Down
18 changes: 2 additions & 16 deletions llvm/unittests/ADT/IListIteratorBitsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ TEST(IListIteratorBitsTest, ConsAndAssignment) {

simple_ilist<Node, ilist_iterator_bits<true>>::iterator I, I2;

// Two sets of tests: if we've compiled in the iterator bits, then check that
// HeadInclusiveBit and TailInclusiveBit are preserved on assignment and copy
// construction, but not on other operations.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
// Check that HeadInclusiveBit and TailInclusiveBit are preserved on
// assignment and copy construction, but not on other operations.
I = L.begin();
EXPECT_FALSE(I.getHeadBit());
EXPECT_FALSE(I.getTailBit());
Expand All @@ -85,18 +83,6 @@ TEST(IListIteratorBitsTest, ConsAndAssignment) {
simple_ilist<Node, ilist_iterator_bits<true>>::iterator I3(I);
EXPECT_TRUE(I3.getHeadBit());
EXPECT_TRUE(I3.getTailBit());
#else
// The calls should be available, but shouldn't actually store information.
I = L.begin();
EXPECT_FALSE(I.getHeadBit());
EXPECT_FALSE(I.getTailBit());
I.setHeadBit(true);
I.setTailBit(true);
EXPECT_FALSE(I.getHeadBit());
EXPECT_FALSE(I.getTailBit());
// Suppress warnings as we don't test with this variable.
(void)I2;
#endif
}

class dummy {
Expand Down
6 changes: 0 additions & 6 deletions llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ using namespace llvm;

extern cl::opt<bool> UseNewDbgInfoFormat;

// None of these tests are meaningful or do anything if we do not have the
// experimental "head" bit compiled into ilist_iterator (aka
// ilist_iterator_w_bits), thus there's no point compiling these tests in.
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS

static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
std::unique_ptr<Module> Mod = parseAssemblyString(IR, Err, C);
Expand Down Expand Up @@ -1535,4 +1530,3 @@ TEST(BasicBlockDbgInfoTest, DbgMoveToEnd) {
}

} // End anonymous namespace.
#endif // EXPERIMENTAL_DEBUGINFO_ITERATORS

0 comments on commit 92eaf03

Please sign in to comment.