Skip to content

Commit

Permalink
Merge pull request #1422 from adityavardhanpadala/master
Browse files Browse the repository at this point in the history
Add llvm-17.0.6 support
  • Loading branch information
yuleisui committed Apr 2, 2024
2 parents cc81fe9 + 3d23dbd commit 72dcf10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion svf-llvm/include/SVF-LLVM/BasicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ typedef llvm::IntrinsicInst IntrinsicInst;
typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
typedef llvm::DbgVariableIntrinsic DbgVariableIntrinsic;
typedef llvm::DbgDeclareInst DbgDeclareInst;
typedef llvm::DbgAddrIntrinsic DbgAddrIntrinsic;
typedef llvm::DbgInfoIntrinsic DbgInfoIntrinsic;
typedef llvm::DbgValueInst DbgValueInst;
typedef llvm::DbgLabelInst DbgLabelInst;
typedef llvm::VPIntrinsic VPIntrinsic;
Expand Down
10 changes: 8 additions & 2 deletions svf-llvm/lib/LLVMUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ bool LLVMUtil::isPtrInUncalledFunction (const Value* value)
bool LLVMUtil::isIntrinsicFun(const Function* func)
{
if (func && (func->getIntrinsicID() == llvm::Intrinsic::donothing ||
func->getIntrinsicID() == llvm::Intrinsic::dbg_addr ||
func->getIntrinsicID() == llvm::Intrinsic::dbg_declare ||
func->getIntrinsicID() == llvm::Intrinsic::dbg_label ||
func->getIntrinsicID() == llvm::Intrinsic::dbg_value))
Expand Down Expand Up @@ -511,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 Expand Up @@ -693,7 +699,7 @@ const std::string LLVMUtil::getSourceLoc(const Value* val )
{
if (SVFUtil::isa<AllocaInst>(inst))
{
for (llvm::DbgInfoIntrinsic *DII : FindDbgAddrUses(const_cast<Instruction*>(inst)))
for (llvm::DbgInfoIntrinsic *DII : FindDbgDeclareUses(const_cast<Instruction*>(inst)))
{
if (llvm::DbgDeclareInst *DDI = SVFUtil::dyn_cast<llvm::DbgDeclareInst>(DII))
{
Expand Down

0 comments on commit 72dcf10

Please sign in to comment.