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

Add llvm-17.0.6 support #1422

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Could you add a macro for this?

#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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the macro.

#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
Loading