Skip to content

Null pointer#13

Open
ayush-qubit wants to merge 15 commits intoreSHARMA:masterfrom
ayush-qubit:NullPointer
Open

Null pointer#13
ayush-qubit wants to merge 15 commits intoreSHARMA:masterfrom
ayush-qubit:NullPointer

Conversation

@ayush-qubit
Copy link
Copy Markdown
Contributor

This pull request is for Null Pointer support

}

/// insert IR Name and Source Name mapping
void ReplaceIRVar::insert(std::string Name){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Would you like to create a separate pull request for the changes related to replace IR vars?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I will.

if (llvm::isa<llvm::LoadInst>(Inst))
return {1, 2};
return {1, 1};
/// extractPHINodeToken - Returns aliases for the PHINode instruction
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'll take a look at phi node-related changes after we are good with nullptr support. It looks like the proposed implementation assumes phi nodes will have 2 operands always which is not true.

llvm::Value *ValOp = Inst->getValueOperand();
if (!llvm::isa<llvm::ConstantInt>(ValOp))
TokenVec.push_back(this->getToken(ValOp));
// if (!llvm::isa<llvm::ConstantInt>(ValOp))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

nit: remove commented code

/// extractStatementType - Returns the relative level of redirection based of
/// LHS and RHS on the statement
template <typename Ty>
std::pair<int, int> TokenWrapper::extractStatementType(Ty *Inst) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This logic has now moved to InstModel/GenericInstModel/GenericInstModel.cpp, you may want to do your changes there

for (auto Src : this->getPointee(Src)) {
for (auto Dest : this->getPointee(Dest)) {
this->insert(Src, Dest);
if(Dest->isNull()){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Points-to graph need not know anything about nullptr. We should treat nullptr as a location in the heap and should keep redirection level 0 for it.

Copy link
Copy Markdown
Owner

@reSHARMA reSHARMA left a comment

Choose a reason for hiding this comment

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

Nullptr support looks good, I've suggested some changes.

I'll suggest changes for the rest later.

Copy link
Copy Markdown
Contributor Author

@ayush-qubit ayush-qubit left a comment

Choose a reason for hiding this comment

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

I have done changes that you suggested.

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.

2 participants