My Pass error

Hi,

I am trying to integrate my pass with the current llvm version 3.8.0. My pass was running fine with llvm 3.4. I am novice in CMake. I am getting a huge error list at the time of make.

My CMakeLists file:

set( LLVM_DIR “${LLVM_ROOT}/share/llvm/cmake” )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_DIR} )
find_package(LLVM)
include(AddLLVM)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})

add_llvm_loadable_module(LoopGraphAnalysisPass_0
LoopGraphAnalysisPass.cpp
)

My errors are attached in a separate file

Deep

errors.txt (10.2 KB)

Hi Manideepa,

Moving from 3.4 to 3.8 is a huge step. LLVM’s codebase moves very quickly and we are (deliberately) worry very little about refactoring heavily. Therefore build errors are expected.

Looking at your errors, I can’t see any reason your CMakeLists would be at fault. The errors are primarily API changes - you’ll have to go and look at each individually to understand what LLVM now returns/accepts and how to modify your code.

Specifically:

error: base operand of ‘->’ has non-pointer type ‘llvm::LoopInfo’

This means you previously had a LoopInfo*, and now you have a LoopInfo&.

error: ‘ID’ is not a member of ‘llvm::PostDominatorTree’

PostDominatorTree is no longer a Pass. It is an analysis object - you get one by using a different pass: PostDominatorWrapperPass, and calling ->getDomTree() on it. There are examples in in-tree LLVM passes.

/home/manideepa/Desktop/research/compiler/llvm3.8/llvm/include/llvm/PassAnalysisSupport.h:61:39: error: ‘ID’ is not a member of ‘llvm::AAResults’

The Alias Analysis hierarchy has changed substantially. I suggest going and looking at the documentation, but you now need to obtain an AliasAnalysisWrapperPass and call getAAResults().

You’ve got the same problem with MemoryDependenceAnalysis and ScalarEvolution. I’d go look at a pass in-tree and see what that does differently to your pass.

PS: LLVM now uses range based for loops heavily, so you can rewrite this:

for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) //gives the collection of Loops

to this:
for(auto *L : LI)