Skip to content

Commit

Permalink
Fix global variable insertion in LLVMUtil.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
adityavardhanpadala committed Apr 2, 2024
1 parent e3e07ef commit 3d23dbd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions svf-llvm/lib/LLVMUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,14 @@ void LLVMUtil::removeFunAnnotations(Set<Function*>& removedFuncList)
glob->setName("llvm.global.annotations.old");
GlobalVariable *GV = new GlobalVariable(newCA->getType(), glob->isConstant(), glob->getLinkage(), newCA, "llvm.global.annotations");
GV->setSection(glob->getSection());

#if (LLVM_VERSION_MAJOR < 17)
module->getGlobalList().push_back(GV);
#elif (LLVM_VERSION_MAJOR >= 17)
module->insertGlobalVariable(GV);
#else
assert(false && "llvm version not supported!");
#endif

glob->replaceAllUsesWith(GV);
glob->eraseFromParent();
Expand Down

0 comments on commit 3d23dbd

Please sign in to comment.