diff options
author | Tim Northover <tnorthover@apple.com> | 2017-03-09 21:12:06 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-03-09 21:12:06 +0000 |
commit | 7a9ea8f628f863c2cde41e63be45a2e47fbd95ef (patch) | |
tree | 352006c08d3894ee9c6e38b6a68d3710c6cc3831 /llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | |
parent | 7e56366204287a513420a2633daa1f92b009f4bf (diff) | |
download | bcm5719-llvm-7a9ea8f628f863c2cde41e63be45a2e47fbd95ef.tar.gz bcm5719-llvm-7a9ea8f628f863c2cde41e63be45a2e47fbd95ef.zip |
GlobalISel: put debug info for static allocas in the MachineFunction.
The good reason to do this is that static allocas are pretty simple to handle
(especially at -O0) and avoiding tracking DBG_VALUEs throughout the pipeline
should give some kind of performance benefit.
The bad reason is that the debug pipeline is an unholy mess of implicit
contracts, where determining whether "DBG_VALUE %reg, imm" actually implies a
load or not involves the services of at least 3 soothsayers and the sacrifice
of at least one chicken. And it still gets it wrong if the variable is at SP
directly.
llvm-svn: 297410
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4d1ac680a45..b6ce59dc120 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -598,18 +598,18 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, return true; } - unsigned Reg = getOrCreateVReg(*Address); - auto RegDef = MRI->def_instr_begin(Reg); assert(DI.getVariable()->isValidLocationForIntrinsic( MIRBuilder.getDebugLoc()) && "Expected inlined-at fields to agree"); - - if (RegDef != MRI->def_instr_end() && - RegDef->getOpcode() == TargetOpcode::G_FRAME_INDEX) { - MIRBuilder.buildFIDbgValue(RegDef->getOperand(1).getIndex(), - DI.getVariable(), DI.getExpression()); + auto AI = dyn_cast<AllocaInst>(Address); + if (AI && AI->isStaticAlloca()) { + // Static allocas are tracked at the MF level, no need for DBG_VALUE + // instructions (in fact, they get ignored if they *do* exist). + MF->setVariableDbgInfo(DI.getVariable(), DI.getExpression(), + getOrCreateFrameIndex(*AI), DI.getDebugLoc()); } else - MIRBuilder.buildDirectDbgValue(Reg, DI.getVariable(), DI.getExpression()); + MIRBuilder.buildDirectDbgValue(getOrCreateVReg(*Address), + DI.getVariable(), DI.getExpression()); return true; } case Intrinsic::vaend: |