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

Removed TerminatorInst #1

Closed
wins2on opened this issue Dec 23, 2019 · 5 comments
Closed

Removed TerminatorInst #1

wins2on opened this issue Dec 23, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@wins2on
Copy link
Collaborator

wins2on commented Dec 23, 2019

TerminatorInst was removed in the newer version of LLVM: http://lists.llvm.org/pipermail/llvm-dev/2018-May/123407.html

Error stack:
`[lute]s1652379: make

Scanning dependencies of target Test_dummy_pass
[ 8%] Building CXX object Test_Dummy_pass/CMakeFiles/Test_dummy_pass.dir/test_pass.cpp.o
[ 16%] Linking CXX shared module libTest_dummy_pass.so
[ 16%] Built target Test_dummy_pass
Scanning dependencies of target Basic_techniques
[ 25%] Building CXX object Basic_Techniques/CMakeFiles/Basic_techniques.dir/basic_techniques.cpp.o
[ 33%] Linking CXX shared module libBasic_techniques.so
[ 33%] Built target Basic_techniques
Scanning dependencies of target Runtime_func_trace_postorder
[ 41%] Building CXX object Function_call_recorder/CMakeFiles/Runtime_func_trace_postorder.dir/func_call_rec_postorder.cpp.o
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp: In member function ‘void {anonymous}::Func_call::parse_value(llvm::Value*, llvm::Value*&, llvm::Type*&, llvm::Instruction*, unsigned int, llvm::Module&, llvm::LLVMContext&)’:
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:108:13: error: ‘TerminatorInst’ was not declared in this scope
TerminatorInst if_term, else_term;
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:108:29: error: ‘if_term’ was not declared in this scope
TerminatorInst if_term, else_term;
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:108:39: error: ‘else_term’ was not declared in this scope
TerminatorInst if_term, else_term;
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp: In member function ‘void {anonymous}::Func_call::declare_extern_funcs(llvm::Module&, llvm::LLVMContext&)’:
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:326:21: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
print_trace = M.getOrInsertFunction("_Z11print_tracev", Type::getVoidTy(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:329:21: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
record_call = M.getOrInsertFunction("Z11record_callPKcS0", Type::getInt32Ty(module_context), Type::getInt8PtrTy(module_context), Type::getInt8PtrTy(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:330:23: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
record_invoke = M.getOrInsertFunction("Z13record_invokePKcS0", Type::getInt32Ty(module_context), Type::getInt8PtrTy(module_context), Type::getInt8PtrTy(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:331:27: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
record_exit_point = M.getOrInsertFunction("Z17record_exit_pointPKcS0", Type::getInt32Ty(module_context), Type::getInt8PtrTy(module_context), Type::getInt8PtrTy(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:333:21: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
update_void = M.getOrInsertFunction("_Z11update_voidjj", Type::getVoidTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:334:18: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant
’ in assignment
update_1 = M.getOrInsertFunction("_Z8update_1bjj", Type::getVoidTy(module_context), Type::getInt1Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:335:18: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_8 = M.getOrInsertFunction("_Z8update_8hjj", Type::getVoidTy(module_context), Type::getInt8Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:336:19: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_16 = M.getOrInsertFunction("_Z9update_16tjj", Type::getVoidTy(module_context), Type::getInt16Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:337:19: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_32 = M.getOrInsertFunction("_Z9update_32jjj", Type::getVoidTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:338:19: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_64 = M.getOrInsertFunction("_Z9update_64mjj", Type::getVoidTy(module_context), Type::getInt64Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:339:20: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_128 = M.getOrInsertFunction("_Z10update_128ojj", Type::getVoidTy(module_context), Type::getInt128Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:340:22: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_float = M.getOrInsertFunction("_Z12update_floatfjj", Type::getVoidTy(module_context), Type::getFloatTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:341:23: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_double = M.getOrInsertFunction("_Z13update_doubledjj", Type::getVoidTy(module_context), Type::getDoubleTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:342:20: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_ptr = M.getOrInsertFunction("_Z10update_ptrmjj", Type::getVoidTy(module_context), Type::getInt64Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:343:22: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_array = M.getOrInsertFunction("_Z12update_arraymjj", Type::getVoidTy(module_context), Type::getInt64Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:344:23: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_struct = M.getOrInsertFunction("_Z13update_structPKcmjj", Type::getVoidTy(module_context), Type::getInt8PtrTy(module_context), Type::getInt64Ty(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:345:26: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_exception = M.getOrInsertFunction("_Z16update_exceptionj", Type::getVoidTy(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:346:26: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_undefined = M.getOrInsertFunction("_Z16update_undefinedPKcjj", Type::getVoidTy(module_context), Type::getInt8PtrTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
/afs/inf.ed.ac.uk/user/s16/s1652379/foivosLlvm/llvmTools/Function_call_recorder/func_call_rec_postorder.cpp:347:28: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment
update_unallocated = M.getOrInsertFunction("_Z11update_unallocatedjj", Type::getVoidTy(module_context), Type::getInt32Ty(module_context), Type::getInt32Ty(module_context));
^
make[2]: *** [Function_call_recorder/CMakeFiles/Runtime_func_trace_postorder.dir/func_call_rec_postorder.cpp.o] Error 1
make[1]: *** [Function_call_recorder/CMakeFiles/Runtime_func_trace_postorder.dir/all] Error 2
make: *** [all] Error 2`

@fivosts
Copy link
Owner

fivosts commented Dec 23, 2019

Interesting. LLVM commit ID you built with ?
What was the official workaround of the TermInst removal ?

@wins2on
Copy link
Collaborator Author

wins2on commented Dec 24, 2019

LLVM (https://github.com/llvm/llvm-project/tree/release/9.x) commit ID is 432bf48c08da748e2542cf40e3ab9aee53a744b0.

Here are the steps on removing TerminatorInst (https://reviews.llvm.org/D47467):

  • Remove the few remaining APIs of TerminatorInst, replacing them with existing predicates in Instruction or adding new ones if needed.
  • Replacing isa and dyn_cast with appropriate uses of isTerminator.
  • Replacing TerminatorInst in parameter APIs with just Instruction and potentially an assert on isTerminator.
  • Replacing TerminatorInst in the return of the remaining APIs (not updated above) with Instruction. Most notably, the getTerminator method.
  • Removing TerminotarInst type completely.
  • Making InvokeInst and CallInst derive from a common base class w/ most of the logic currently in CallInst.
  • Replacing uses of CallSite everywhere with the common base class.

@fivosts fivosts self-assigned this Dec 24, 2019
@fivosts fivosts added the bug Something isn't working label Dec 24, 2019
@fivosts
Copy link
Owner

fivosts commented Dec 25, 2019

@wins2on See the attached issue to check progress on llvm 9.0 migration. When I resolve the TerminatorInst compatibility issue I will close this issue.

#2

@fivosts
Copy link
Owner

fivosts commented Dec 26, 2019

Resolved with this: f05e43e

Compilation still breaks due to other compatibility issue: Function calls have been re-typed from Constant* to FunctionCallee

@fivosts
Copy link
Owner

fivosts commented Dec 27, 2019

Fixed compilation with cce4312

Pass compiles but has not been tested yet.

@fivosts fivosts closed this as completed Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants