Skip to content

Commit 7f309ab

Browse files
committed
Minor CG performance improvement
1 parent 96b29fe commit 7f309ab

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/PhasarLLVM/ControlFlow/Resolver/OTFResolver.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,17 @@ auto OTFResolver::resolveFunctionPointer(const llvm::CallBase *CallSite)
140140
if (const auto *FTy = llvm::dyn_cast<llvm::FunctionType>(
141141
CallSite->getCalledOperand()->getType()->getPointerElementType())) {
142142

143-
const auto PTS =
143+
const auto *PTS =
144144
PT.getPointsToSet(CallSite->getCalledOperand(), CallSite);
145145

146146
llvm::SmallVector<const llvm::GlobalVariable *, 2> GlobalVariableWL;
147147
llvm::SmallVector<const llvm::ConstantAggregate *> ConstantAggregateWL;
148148

149149
for (const auto *P : *PTS) {
150+
if (!llvm::isa<llvm::Constant>(P)) {
151+
continue;
152+
}
153+
150154
GlobalVariableWL.clear();
151155
ConstantAggregateWL.clear();
152156

lib/PhasarLLVM/Pointer/LLVMPointsToSet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ namespace psr {
5252
LLVMPointsToSet::LLVMPointsToSet(ProjectIRDB &IRDB, bool UseLazyEvaluation,
5353
PointerAnalysisType PATy)
5454
: PTA(IRDB, UseLazyEvaluation, PATy), Owner(IRDB.getNumGlobals()) {
55+
56+
PointsToSets.reserve(IRDB.getNumGlobals());
57+
5558
for (llvm::Module *M : IRDB.getAllModules()) {
5659
// compute points-to information for all globals
5760

0 commit comments

Comments
 (0)