Skip to content

Commit 0d73cd3

Browse files
committed
fix corner case in LLVMBasedCFG::getStartPointsOf - when ignoring debug instructions, return first non-debug instruction of function
1 parent ed67292 commit 0d73cd3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/PhasarLLVM/ControlFlow/LLVMBasedCFG.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ LLVMBasedCFG::getStartPointsOf(const llvm::Function *Fun) const {
135135
return {};
136136
}
137137
if (!Fun->isDeclaration()) {
138-
return {&Fun->front().front()};
138+
auto *EntryInst = &Fun->front().front();
139+
if (IgnoreDbgInstructions && EntryInst->isDebugOrPseudoInst()) {
140+
return {EntryInst->getNextNonDebugInstruction()};
141+
}
142+
return {EntryInst};
139143
} else {
140144
LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG)
141145
<< "Could not get starting points of '"

0 commit comments

Comments
 (0)