Skip to content

Remove BasicBlock Values#1841

Merged
yuleisui merged 10 commits into
SVF-tools:masterfrom
mbarbar:no-bb-val
Jun 30, 2026
Merged

Remove BasicBlock Values#1841
yuleisui merged 10 commits into
SVF-tools:masterfrom
mbarbar:no-bb-val

Conversation

@mbarbar

@mbarbar mbarbar commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

They do not appear to be used anywhere.

@mbarbar mbarbar requested a review from yuleisui June 17, 2026 03:01
@mbarbar mbarbar marked this pull request as draft June 17, 2026 03:05
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.45%. Comparing base (2c35d05) to head (96ea79a).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1841      +/-   ##
==========================================
- Coverage   64.46%   64.45%   -0.01%     
==========================================
  Files         252      252              
  Lines       25216    25209       -7     
  Branches     4767     4767              
==========================================
- Hits        16255    16248       -7     
  Misses       8961     8961              
Files with missing lines Coverage Δ
svf-llvm/lib/SVFIRBuilder.cpp 88.90% <ø> (-0.04%) ⬇️
svf-llvm/lib/SymbolTableBuilder.cpp 87.88% <100.00%> (+0.03%) ⬆️
svf/include/SVFIR/SVFIR.h 91.39% <ø> (-0.10%) ⬇️
svf/include/SVFIR/SVFValue.h 88.88% <ø> (ø)
svf/include/SVFIR/SVFVariables.h 68.28% <ø> (+0.45%) ⬆️
svf/lib/SVFIR/SVFVariables.cpp 67.65% <ø> (+0.71%) ⬆️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbarbar mbarbar marked this pull request as ready for review June 17, 2026 08:34
}
else if (SVFUtil::isa<BasicBlock>(llvmValue))
{
pag->addBasicBlockValNode(iter->second, llvmModuleSet()->getSVFType(llvmValue->getType()));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would still keep this branch but remove "pag->addBasicBlockValNode(iter->second, llvmModuleSet()->getSVFType(llvmValue->getType()));" and put a comment.

It is better to move this branch just below the branch "if (const Function* func = SVFUtil::dyn_cast(llvmValue))", so it is clearer that we don;t handle basicblock.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep okay. I'm planning later to open a PR removing ASMPCValNode. Should I do the same for its branch?

@yuleisui yuleisui Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is good to put it under the same pr.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Pushed its removal.

@mbarbar mbarbar changed the title Remove BasicBlock values Remove unused Values Jun 23, 2026
Comment thread svf-llvm/lib/SVFIRBuilder.cpp Outdated
}
else
{
pag->addDummyValNode(iter->second, icfgNode);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why did you add a dummy for any unhandled node? Also good to make a comment here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would this cause a new dummy node to be created for any LLVM value not on PAG?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I'm experimenting a bit but I'm not really sure what we should do. Some observations:

From what I gather from the log, before BB nodes and ASM etc. nodes were added, I believe it was adding a standard Val node.

SVF expects the number of PAG nodes to be same or greater than the number of symbols. To ignore these symbols in the first place, well they actually exist in the IR and are referred to. For the ASM nodes, I found a case where getCalledOperand() returns an inline ASM node so it needs a corresponding Val node, but we were never properly analysing any ASM node...

So I'm conflicted. On the one hand these nodes are referred to in the IR, on the other hand our model in SVF has been ignoring them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it is best to ignore these LLVM values and do not create nodes for these values if we don't analyse them. Which ones we may analyse later?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Dummy nodes contains a bit too many types of llvm values and if we keep these llvm values in the form of dummy nodes, it will be a bit hard to maintain later

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

How should we deal with e.g this

void SVFIRBuilder::handleIndCall(CallBase* cs)
{
    const CallICFGNode* cbn = llvmModuleSet()->getCallICFGNode(cs);
    NodeID indFunPtrId = llvmModuleSet()->getValueNode(cs->getCalledOperand());
    const_cast<CallICFGNode*>(cbn)->setIndFunPtr(pag->getGNode(indFunPtrId));
    pag->addIndirectCallsites(cbn,indFunPtrId);
}

cs->getCalledOperand() returns an InlineAsm Value which is fed into getGNode.

The node has forever existed I believe, first as a generic Val node then as an InlineAsmVal node.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, then we may have to keep AsmPCValNode? Let us do a removal of other unused values first and make this as an issue or a separate pull request.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Mm okay, I will try early next week.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, I will merge it soon. It would be good to make another pull request for AsmPCValNode later.

@mbarbar mbarbar changed the title Remove unused Values Remove BasicBlock Values Jun 30, 2026
@yuleisui yuleisui merged commit cd0750b into SVF-tools:master Jun 30, 2026
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.

2 participants