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

remove some opaque pointer dependencies #1295

Merged
merged 2 commits into from
Dec 22, 2023
Merged

Conversation

jumormt
Copy link
Contributor

@jumormt jumormt commented Dec 21, 2023

remove some opaque pointer dependencies

@@ -1384,7 +1392,8 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
//cast svftype to SVFPointerType
SVFPointerType* svfPtrType = SVFUtil::dyn_cast<SVFPointerType>(svftype);
assert(svfPtrType && "this is not SVFPointerType");
svfPtrType->setPtrElementType(getSVFType(LLVMUtil::getPtrElementType(pt)));
if(!pt->isOpaque())
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this.

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (e094a28) 64.48% compared to head (5034678) 64.45%.
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1295      +/-   ##
==========================================
- Coverage   64.48%   64.45%   -0.03%     
==========================================
  Files         223      223              
  Lines       23850    23870      +20     
==========================================
+ Hits        15380    15386       +6     
- Misses       8470     8484      +14     
Files Coverage Δ
svf-llvm/include/SVF-LLVM/LLVMUtil.h 73.68% <ø> (ø)
svf-llvm/lib/LLVMModule.cpp 82.63% <ø> (ø)
svf-llvm/lib/SVFIRBuilder.cpp 78.28% <100.00%> (ø)
svf-llvm/lib/SymbolTableBuilder.cpp 86.64% <100.00%> (ø)
svf/include/MemoryModel/AccessPath.h 78.57% <100.00%> (ø)
svf/lib/MemoryModel/PointerAnalysis.cpp 58.49% <ø> (ø)
svf/lib/SVFIR/SVFType.cpp 0.00% <ø> (ø)
svf/lib/SVFIR/SymbolTableInfo.cpp 53.05% <ø> (ø)
svf/lib/MemoryModel/AccessPath.cpp 3.12% <0.00%> (+0.03%) ⬆️
svf-llvm/lib/LLVMUtil.cpp 74.08% <28.57%> (-1.83%) ⬇️

@@ -533,6 +533,14 @@ void LLVMModuleSet::loadModules(const std::vector<std::string> &moduleNameVec)

owned_ctx = std::make_unique<LLVMContext>();

#if (LLVM_VERSION_MAJOR <= 14)
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this

@@ -318,8 +318,12 @@ bool SVFIRBuilder::computeGepOffset(const User *V, AccessPath& ap)
// If it's a non-constant offset access
// If its point-to target is struct or array, it's likely an array accessing (%result = gep %struct.A* %a, i32 %non-const-index)
// If its point-to target is single value (pointer arithmetic), then it's a variant gep (%result = gep i8* %p, i32 %non-const-index)
if(!op && gepTy->isPointerTy() && getPtrElementType(SVFUtil::dyn_cast<PointerType>(gepTy))->isSingleValueType())
isConst = false;
if(!op && gepTy->isPointerTy()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrap up this as a function.

const Type* objtype = LLVMUtil::getPtrElementType(ptrType);
(void)getOrAddSVFTypeInfo(objtype);
// don't collect pointee type for opaque pointer
if(!ptrType->isOpaque()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this.

@@ -272,6 +272,8 @@ class Options
// Loop Analysis
static const Option<bool> LoopAnalysis;
static const Option<u32_t> LoopBound;

static const Option<bool> DisableOpaquePointers;
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

else if (const SVFPointerType* ptrOperandType = SVFUtil::dyn_cast<SVFPointerType>(idxOperandType))
elemByteSize = ptrOperandType->getPtrElementType()->getByteSize();
else if (SVFUtil::isa<SVFPointerType>(idxOperandType))
elemByteSize = gep->getAccessPath().getGepPointeeType()->getByteSize();
Copy link
Collaborator

Choose a reason for hiding this comment

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

getGepPointeeType => gepSrcPointeeType

Comment on lines 23 to 24
if(isOpaque()) os << "ptr";
else os << *ptrElementType << '*';
Copy link
Collaborator

Choose a reason for hiding this comment

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

print "ptr"

@@ -368,10 +368,14 @@ class SVFPointerType : public SVFType
}
inline const SVFType* getPtrElementType() const
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this function

@jumormt jumormt reopened this Dec 22, 2023
@yuleisui yuleisui merged commit dee5caa into SVF-tools:master Dec 22, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants