Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM Build fails if exception enabled #63702

Open
kmistryic opened this issue Jul 6, 2023 · 5 comments · Fixed by #69485 · May be fixed by #92504
Open

LLVM Build fails if exception enabled #63702

kmistryic opened this issue Jul 6, 2023 · 5 comments · Fixed by #69485 · May be fixed by #92504
Labels
build-problem llvm Umbrella label for LLVM issues

Comments

@kmistryic
Copy link

kmistryic commented Jul 6, 2023

CMake options to reproduce.
-DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_EXAMPLES=ON

/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp: In function ‘uintptr_t readSLEB128(const uint8_t**)’:
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:374:22: warning: left shift of negative value [-Wshift-negative-value]
  374 |     result |= (~0 << shift);
      |                      ^~~~~
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp: In function ‘llvm::BasicBlock* createFinallyBlock(llvm::LLVMContext&, llvm::Module&, llvm::IRBuilder<>&, llvm::Function&, std::string&, std::string&, llvm::BasicBlock&, llvm::BasicBlock&, llvm::Value**, llvm::Value**, llvm::Value**)’:
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1001:76: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLoad(llvm::Value*&)’
 1001 |                                                        *exceptionCaughtFlag),
      |                                                                            ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const char*)’
 1735 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const llvm::Twine&)’
 1739 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, bool, const llvm::Twine&)’
 1743 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note:   candidate expects 4 arguments, 1 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp: In function ‘llvm::Function* createCatchWrappedInvokeFunction(llvm::Module&, llvm::IRBuilder<>&, llvm::legacy::FunctionPassManager&, llvm::Function&, std::string, unsigned int, unsigned int*)’:
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1189:57: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLoad(llvm::Value*&)’
 1189 |                      builder.CreateLoad(exceptionStorage));
      |                                                         ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const char*)’
 1735 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const llvm::Twine&)’
 1739 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, bool, const llvm::Twine&)’
 1743 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note:   candidate expects 4 arguments, 1 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1209:62: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLoad(llvm::Value*&)’
 1209 |   builder.CreateResume(builder.CreateLoad(caughtResultStorage));
      |                                                              ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const char*)’
 1735 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const llvm::Twine&)’
 1739 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, bool, const llvm::Twine&)’
 1743 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note:   candidate expects 4 arguments, 1 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1249:13: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLoad(llvm::Value*)’
 1249 |           0));
      |             ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const char*)’
 1735 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const llvm::Twine&)’
 1739 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, bool, const llvm::Twine&)’
 1743 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note:   candidate expects 4 arguments, 1 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1282:79: error: no matching function for call to ‘llvm::IRBuilder<>::CreateConstGEP1_64(llvm::Value*&, int64_t&)’
 1282 |                                                        ourBaseFromUnwindOffset),
      |                                                                               ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1872:10: note: candidate: ‘llvm::Value* llvm::IRBuilderBase::CreateConstGEP1_64(llvm::Type*, llvm::Value*, uint64_t, const llvm::Twine&)’
 1872 |   Value *CreateConstGEP1_64(Type *Ty, Value *Ptr, uint64_t Idx0,
      |          ^~~~~~~~~~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1872:10: note:   candidate expects 4 arguments, 2 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1298:63: error: no matching function for call to ‘llvm::IRBuilder<>::CreateLoad(llvm::Value*&)’
 1298 |                        *(builder.CreateLoad(typeInfoThrownType)),
      |                                                               ^
In file included from /home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:56:
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const char*)’
 1735 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const char *Name) {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1735:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, const llvm::Twine&)’
 1739 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, const Twine &Name = "") {
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1739:13: note:   candidate expects 3 arguments, 1 provided
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note: candidate: ‘llvm::LoadInst* llvm::IRBuilderBase::CreateLoad(llvm::Type*, llvm::Value*, bool, const llvm::Twine&)’
 1743 |   LoadInst *CreateLoad(Type *Ty, Value *Ptr, bool isVolatile,
      |             ^~~~~~~~~~
/home/kkumar/llvm-project/llvm/include/llvm/IR/IRBuilder.h:1743:13: note:   candidate expects 4 arguments, 1 provided
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp: In function ‘void runExceptionThrow(llvm::ExecutionEngine*, llvm::Function*, int32_t)’:
/home/kkumar/llvm-project/llvm/examples/ExceptionDemo/ExceptionDemo.cpp:1563:29: warning: catching polymorphic type ‘class {anonymous}::OurCppRunException’ by value [-Wcatch-value=]
 1563 |   catch (OurCppRunException exc) {
      |                             ^~~
@EugeneZelenko EugeneZelenko added build-problem llvm Umbrella label for LLVM issues and removed new issue labels Jul 6, 2023
@epitavy
Copy link
Contributor

epitavy commented Oct 18, 2023

Effectively, I have the same problem on main, it exists at least since version 14. The signature Builder::CreateLoad(Value*) does not exist, the Type* is missing as first argument. Is it caused by the combination of cmake options ?
I am not sure I know how to fix the error on builder.CreateConstGEP1_64 line 1282.
The errors with builder.CreateLoad are straightforward to fix.

@epitavy
Copy link
Contributor

epitavy commented Oct 18, 2023

Moreover, some code is just wrong, as in

llvm::Value *typeInfoThrownType =
builder.CreateStructGEP(builder.getInt8PtrTy(), typeInfoThrown, 0);

where CreateStructGEP is used on a Int8Ptr.

@epitavy
Copy link
Contributor

epitavy commented Oct 24, 2023

@EugeneZelenko I am waiting for a review of the PR, could you take it ?

@EugeneZelenko
Copy link
Contributor

@epitavy: You could look onto file history to find previous contributors - they would be best reviewers.

@epitavy
Copy link
Contributor

epitavy commented Oct 25, 2023

@joker-eph

epitavy added a commit to epitavy/llvm-project that referenced this issue Mar 19, 2024
epitavy added a commit to epitavy/llvm-project that referenced this issue Mar 19, 2024
epitavy added a commit to epitavy/llvm-project that referenced this issue Mar 19, 2024
llvm-git-migration pushed a commit to llvm-git-migration/llvm-project that referenced this issue Mar 19, 2024
llvm-git-migration pushed a commit to llvm-git-migration/llvm-project that referenced this issue Mar 19, 2024
llvm-git-migration pushed a commit to llvm-git-migration/llvm-project that referenced this issue Mar 19, 2024
epitavy added a commit to epitavy/llvm-project that referenced this issue Mar 19, 2024
epitavy added a commit to epitavy/llvm-project that referenced this issue Mar 27, 2024
kamleshbhalui pushed a commit that referenced this issue May 15, 2024
The ExceptionDemo example was no longer compiling (since llvm 14 at
least). The PR makes the example work with the current API and also
transition from MCJIT to ORC.
Fixes #63702
@kamleshbhalui kamleshbhalui reopened this May 15, 2024
epitavy added a commit to epitavy/llvm-project that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem llvm Umbrella label for LLVM issues
Projects
None yet
4 participants