}
}
-static DebugLoc getFunctionEntryDebugLocation(Function &F) {
- for (const auto &Inst : F.getEntryBlock())
- if (!isa<AllocaInst>(Inst)) return Inst.getDebugLoc();
- return DebugLoc();
-}
-
PHINode *FunctionStackPoisoner::createPHI(IRBuilder<> &IRB, Value *Cond,
Value *ValueIfTrue,
Instruction *ThenTerm,
if (AllocaVec.size() == 0) return;
int StackMallocIdx = -1;
- DebugLoc EntryDebugLocation = getFunctionEntryDebugLocation(F);
+ DebugLoc EntryDebugLocation;
+ if (auto SP = getDISubprogram(&F))
+ EntryDebugLocation = DebugLoc::get(SP->getScopeLine(), 0, SP);
Instruction *InsBefore = AllocaVec[0];
IRBuilder<> IRB(InsBefore);