gollvm compilation issue

137 views
Skip to first unread message

Zhen Huang

unread,
Feb 9, 2022, 1:57:08 AM2/9/22
to golang-nuts
I tried to build gollvm with the latest llvm, but it failed with several compilation errors, such as the one below. Using llvm-13.0.0 resulted in compilation errors too. Did anyone get into similar errors?

/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp: In function ‘llvm::AttributeList legalizeCallAttributes(llvm::LLVMContext&, llvm::AttributeList)’:
/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1286:38: error: conversion from ‘llvm::AttributeSet’ to non-scalar type ‘llvm::AttrBuilder’ requested
 1286 |   AttrBuilder FnAttrs = AL.getFnAttrs();
/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1292:22: error: cannot convert ‘llvm::Attribute’ to ‘const llvm::AttributeMask&’
 1292 |       FnAttrs.remove(A);
      |                      ^
      |                      |
      |                      llvm::Attribute
In file included from /home/user/code/llvm/llvm-project/llvm/include/llvm/IR/Argument.h:18,
                 from /home/user/code/llvm/llvm-project/llvm/include/llvm/IR/Function.h:25,
                 from /home/user/code/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:45,
                 from /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.h:20,
                 from /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:15:
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/Attributes.h:1041:44: note:   initializing argument 1 of ‘llvm::AttrBuilder& llvm::AttrBuilder::remove(const llvm::AttributeMask&)’
 1041 |   AttrBuilder &remove(const AttributeMask &AM);
      |                       ~~~~~~~~~~~~~~~~~~~~~^~

eric...@arm.com

unread,
Feb 9, 2022, 2:43:19 AM2/9/22
to golang-nuts
I just filed a patch for this issue, see https://go-review.googlesource.com/c/gollvm/+/384394

Zhen Huang

unread,
Feb 9, 2022, 2:34:18 PM2/9/22
to eric...@arm.com, golang-nuts
Thank you for the prompt response! I checked out the updated code and the previous compilation error is gone. However, another compilation error came up:

[183/1626] Building CXX object tools/g...LVMCppGoPasses.dir/GoStatepoints.cpp.o
FAILED: tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o
/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/gollvm/passes -I/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes -Iinclude -I/home/user/code/llvm/llvm-project/llvm/include -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-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -g    -fno-exceptions -fno-rtti -fcf-protection=none -std=c++14 -MD -MT tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -MF tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o.d -o tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -c /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp
/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp: In function ‘void makeStatepointExplicitImpl(llvm::CallBase*, llvm::SmallVectorImpl<llvm::Value*>&, llvm::SmallVectorImpl<llvm::Value*>&, {anonymous}::PartiallyConstructedSafepointRecord&, std::vector<{anonymous}::DeferredReplacement>&)’:
/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1433:65: warning: ‘llvm::Type* llvm::PointerType::getElementType() const’ is deprecated: Pointer element types are deprecated. You can *temporarily* use Type::getPointerElementType() instead [-Wdeprecated-declarations]
 1433 |       Type *T = cast<PointerType>(V->getType())->getElementType();
      |                                                                 ^
In file included from /home/user/code/llvm/llvm-project/llvm/include/llvm/IR/Function.h:29,

                 from /home/user/code/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:45,
                 from /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.h:20,
                 from /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:15:
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/DerivedTypes.h:675:9: note: declared here
  675 |   Type *getElementType() const {
      |         ^~~~~~~~~~~~~~
/home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1517:27: error: no matching function for call to ‘llvm::IRBuilder<>::CreateGCStatepointInvoke(uint64_t&, uint32_t&, llvm::Value*&, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Use>&, llvm::ArrayRef<llvm::Value*>&, llvm::ArrayRef<llvm::Value*>, const char [17])’
 1517 |         "statepoint_token");
      |                           ^
In file included from /home/user/code/llvm/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:45:
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:809:3: note: candidate: ‘llvm::InvokeInst* llvm::IRBuilderBase::CreateGCStatepointInvoke(uint64_t, uint32_t, llvm::FunctionCallee, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, llvm::Optional<llvm::ArrayRef<llvm::Value*> >, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&)’
  809 |   CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:810:43: note:   no known conversion for argument 3 from ‘llvm::Value*’ to ‘llvm::FunctionCallee’
  810 |                            FunctionCallee ActualInvokee, BasicBlock *NormalDest,
      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:817:15: note: candidate: ‘llvm::InvokeInst* llvm::IRBuilderBase::CreateGCStatepointInvoke(uint64_t, uint32_t, llvm::FunctionCallee, llvm::BasicBlock*, llvm::BasicBlock*, uint32_t, llvm::ArrayRef<llvm::Value*>, llvm::Optional<llvm::ArrayRef<llvm::Use> >, llvm::Optional<llvm::ArrayRef<llvm::Use> >, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&)’
  817 |   InvokeInst *CreateGCStatepointInvoke(
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:817:15: note:   candidate expects 11 arguments, 9 provided
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:828:3: note: candidate: ‘llvm::InvokeInst* llvm::IRBuilderBase::CreateGCStatepointInvoke(uint64_t, uint32_t, llvm::FunctionCallee, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Use>, llvm::Optional<llvm::ArrayRef<llvm::Value*> >, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&)’
  828 |   CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/home/user/code/llvm/llvm-project/llvm/include/llvm/IR/IRBuilder.h:829:43: note:   no known conversion for argument 3 from ‘llvm::Value*’ to ‘llvm::FunctionCallee’
  829 |                            FunctionCallee ActualInvokee, BasicBlock *NormalDest,
      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/X_MOYeEsoRA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e8fe8444-f303-426c-992a-f347e5b106a1n%40googlegroups.com.

Than McIntosh

unread,
Feb 9, 2022, 2:37:01 PM2/9/22
to Zhen Huang, eric...@arm.com, golang-nuts
Thanks for the report. I'll take a look...

Than

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAK0UAmUXwKYuiZtv5zPJAbr3vJpgNVbh7yJ1jJSJVvi9P3EPWQ%40mail.gmail.com.

Than McIntosh

unread,
Feb 9, 2022, 5:54:25 PM2/9/22
to Zhen Huang, eric...@arm.com, golang-nuts
OK, I checked in another CL to resolve this new issue. Give it a try again please and let me know if you are able to build.

Thanks, Than

Zhen Huang

unread,
Feb 11, 2022, 9:27:23 AM2/11/22
to Than McIntosh, eric...@arm.com, golang-nuts
Yes, I can build now. Thank you for the fix.

Reply all
Reply to author
Forward
0 new messages