This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Demangle the function name in DiagnosticInfoDontCall message
ClosedPublic

Authored by ChoKyuWon on Jan 29 2023, 9:15 AM.

Diff Detail

Event Timeline

ChoKyuWon created this revision.Jan 29 2023, 9:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2023, 9:15 AM
ChoKyuWon requested review of this revision.Jan 29 2023, 9:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2023, 9:15 AM

seems reasonable, but needs a test

seems reasonable, but needs a test

Please notify me if I put the test wrong place.
I'm not familiar with the test codebase, so there should be a more suitable place for this test.

I'd just add onto the existing llvm/test/CodeGen/X86/attr-dontcall.ll

Rebase, add test on llvm/test/Codegen/X86/attr-dontcall.ll.

aeubanks accepted this revision.Jan 29 2023, 3:23 PM

do you need me to land this for you?

This revision is now accepted and ready to land.Jan 29 2023, 3:23 PM
This comment was removed by ChoKyuWon.

do you need me to land this for you?

Thank you for your review!
I don't have access right, so if you don't mind, please land this patch for me. If you needed, kyuwoncho18@gmail.com is my email.

nickdesaulniers requested changes to this revision.Jan 30 2023, 9:22 AM
nickdesaulniers added inline comments.
llvm/lib/IR/DiagnosticInfo.cpp
444–445

demangle returns a std::string. Is getting the C string necessary for printing?

This revision now requires changes to proceed.Jan 30 2023, 9:22 AM
aeubanks added inline comments.Jan 30 2023, 10:10 AM
llvm/lib/IR/DiagnosticInfo.cpp
444–445

I'll fix this while landing

aeubanks added inline comments.Jan 30 2023, 10:15 AM
llvm/lib/IR/DiagnosticInfo.cpp
444–445

actually it is necessary. the str() is getting passed to demangle, it's not called on the result of demangle()

demangle() should really take a StringRef instead of a const std::string&, but that can be fixed separately

This revision was not accepted when it landed; it landed in state Needs Revision.Jan 30 2023, 10:16 AM
This revision was automatically updated to reflect the committed changes.
amyk added a subscriber: amyk.Jan 30 2023, 11:13 AM

This patch appears to be causing an issue on the clang-ppc64le-linux-multistage bot (https://lab.llvm.org/buildbot/#/builders/121/builds/27524/steps/4/logs/stdio):

FAILED: lib/libLLVMCore.so.17git 
: && /usr/lib64/ccache/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMCore.so.17git -o lib/libLLVMCore.so.17git lib/IR/CMakeFiles/LLVMCore.dir/AbstractCallSite.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/AsmWriter.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Assumptions.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Attributes.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/AutoUpgrade.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/BasicBlock.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/BuiltinGCs.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Comdat.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ConstantFold.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ConstantRange.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Constants.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Core.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DIBuilder.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DataLayout.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DebugInfo.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DebugInfoMetadata.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DebugLoc.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DiagnosticHandler.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DiagnosticInfo.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/DiagnosticPrinter.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Dominators.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/EHPersonalities.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/FPEnv.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Function.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/GCStrategy.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/GVMaterializer.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Globals.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/IRBuilder.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/IRPrintingPasses.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/SSAContext.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/InlineAsm.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Instruction.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Instructions.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/IntrinsicInst.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/LLVMContext.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/LLVMContextImpl.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/LLVMRemarkStreamer.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/LegacyPassManager.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/MDBuilder.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Mangler.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Metadata.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Module.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ModuleSummaryIndex.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Operator.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/OptBisect.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Pass.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PassInstrumentation.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PassManager.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PassRegistry.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PassTimingInfo.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PrintPasses.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ProfDataUtils.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/SafepointIRVerifier.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ProfileSummary.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/PseudoProbe.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ReplaceConstant.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Statepoint.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/StructuralHash.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Type.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/TypedPointerType.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/TypeFinder.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Use.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/User.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Value.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/ValueSymbolTable.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/VectorBuilder.cpp.o lib/IR/CMakeFiles/LLVMCore.dir/Verifier.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib"  -lpthread  lib/libLLVMBinaryFormat.so.17git  lib/libLLVMRemarks.so.17git  lib/libLLVMTargetParser.so.17git  lib/libLLVMSupport.so.17git  -Wl,-rpath-link,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
lib/IR/CMakeFiles/LLVMCore.dir/DiagnosticInfo.cpp.o: In function `llvm::DiagnosticInfoDontCall::print(llvm::DiagnosticPrinter&) const [clone .localalias.29]':
DiagnosticInfo.cpp:(.text._ZNK4llvm22DiagnosticInfoDontCall5printERNS_17DiagnosticPrinterE+0xa4): undefined reference to `llvm::demangle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status

Would you be able to take a look at this? Thanks in advance.

lenary added a subscriber: lenary.Jan 30 2023, 11:23 AM

I reported the same issue directly on the commit:

This commit causes an issue with -DBUILD_SHARED_LIBS - You need to add Demangle to the LINK_COMPONENTS in llvm/lib/IR/CMakeLists.txt

relanded with IR -> Demangle dependency