bool IRTranslator::translate(const Instruction &Inst) {
CurBuilder->setDebugLoc(Inst.getDebugLoc());
- // We only emit constants into the entry block from here. To prevent jumpy
- // debug behaviour set the line to 0.
- if (const DebugLoc &DL = Inst.getDebugLoc())
- EntryBuilder->setDebugLoc(DILocation::get(
- Inst.getContext(), 0, 0, DL.getScope(), DL.getInlinedAt()));
- else
- EntryBuilder->setDebugLoc(DebugLoc());
auto &TLI = *MF->getSubtarget().getTargetLowering();
if (TLI.fallBackToDAGISel(Inst))
}
bool IRTranslator::translate(const Constant &C, Register Reg) {
+ // We only emit constants into the entry block from here. To prevent jumpy
+ // debug behaviour set the line to 0.
+ if (auto CurrInstDL = CurBuilder->getDL())
+ EntryBuilder->setDebugLoc(DILocation::get(C.getContext(), 0, 0,
+ CurrInstDL.getScope(),
+ CurrInstDL.getInlinedAt()));
+ else
+ EntryBuilder->setDebugLoc(DebugLoc());
+
if (auto CI = dyn_cast<ConstantInt>(&C))
EntryBuilder->buildConstant(Reg, *CI);
else if (auto CF = dyn_cast<ConstantFP>(&C))