This is an archive of the discontinued LLVM Phabricator instance.

[NFC][IR] Make Module::getGlobalList() private
ClosedPublic

Authored by vporpo on Feb 14 2023, 9:35 AM.

Details

Summary

This patch adds several missing GlobalList modifier functions, like
removeGlobalVariable(), eraseGlobalVariable() and insertGlobalVariable().
There is no longer need to access the list directly so it also makes
getGlobalList() private.

Diff Detail

Event Timeline

vporpo created this revision.Feb 14 2023, 9:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 9:35 AM
vporpo requested review of this revision.Feb 14 2023, 9:35 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptFeb 14 2023, 9:35 AM
aeubanks accepted this revision.Feb 14 2023, 9:38 AM
aeubanks added inline comments.
llvm/unittests/IR/ModuleTest.cpp
48–49

can just delete the commented out lines and add the reasoning behind deleting this either as a phabricator comment or in the commit description

This revision is now accepted and ready to land.Feb 14 2023, 9:38 AM
vporpo updated this revision to Diff 497367.Feb 14 2023, 9:44 AM
vporpo marked an inline comment as done.

Removed commented out lines from ModuleTest.cpp

vporpo added inline comments.Feb 14 2023, 9:45 AM
llvm/unittests/IR/ModuleTest.cpp
47–49

I removed this because it is testing whether ilist.sort() works, which is not Module-specific. This requires access to the full GlobalList for no real reason.

This revision was landed with ongoing or failed builds.Feb 14 2023, 2:25 PM
This revision was automatically updated to reflect the committed changes.
fmayer added a subscriber: fmayer.Feb 14 2023, 3:30 PM

This seems to have broken our buildbot: https://lab.llvm.org/buildbot/#/builders/169/builds/16797/steps/8/logs/stdio

CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /b/sanitizer-x86_64-linux-qemu/build/llvm_build0/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/lib/Transforms/IPO -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/lib/Transforms/IPO -I/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/include -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/SCCP.cpp.o -MF lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/SCCP.cpp.o.d -o lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/SCCP.cpp.o -c /b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/lib/Transforms/IPO/SCCP.cpp
/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/lib/Transforms/IPO/SCCP.cpp:478:19: error: out-of-line definition of 'createIPSCCPPass' does not match any declaration in namespace 'llvm'
ModulePass *llvm::createIPSCCPPass() { return new IPSCCPLegacyPass(); }
                  ^~~~~~~~~~~~~~~~
1 error generated.

Yeah sorry about that, I reverted it here: b5f239363a3 Revert "[NFC][IR] Make Module::getGlobalList() private"