summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetInstrInfo.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-11-14 09:20:58 -0800
committerVedant Kumar <vsk@apple.com>2019-11-14 12:48:51 -0800
commit1ee84e5ab2a4b7e79b39d4b5130c749c6a7c08aa (patch)
treeb0a08e6ba3fe50435e66d669bd6122f1f296f3c2 /llvm/lib/CodeGen/TargetInstrInfo.cpp
parent4d02263af0d504593e6312b44dfa7749181a21e4 (diff)
downloadbcm5719-llvm-1ee84e5ab2a4b7e79b39d4b5130c749c6a7c08aa.tar.gz
bcm5719-llvm-1ee84e5ab2a4b7e79b39d4b5130c749c6a7c08aa.zip
[DebugInfo] Allow spill slots in call site parameter descriptions
Allow call site paramter descriptions to reference spill slots. Spill slots are not visible to high-level LLVM IR, so they can safely be referenced during entry value evaluation (as they cannot be clobbered by some other function). This gives a 5% increase in the number of call site parameter DIEs in an LTO x86_64 build of the xnu kernel. This reverts commit eb4c98ca3d2590bad9f6542afbf3a7824d2b53fa ( [DebugInfo] Exclude memory location values as parameter entry values), effectively reintroducing the portion of D60716 which dealt with memory locations (authored by Djordje, Nikola, Ananth, and Ivan). This partially addresses llvm.org/PR43343. However, not all memory operands forwarded to callees live in spill slots. In the xnu build, it may be possible to use an escape analysis to increase the number of call site parameter by another 15% (more details in PR43343). Differential Revision: https://reviews.llvm.org/D70254
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfo.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 81238307d3f..2b987dabd24 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1131,6 +1131,27 @@ TargetInstrInfo::describeLoadedValue(const MachineInstr &MI) const {
} else if (auto DestSrc = isAddImmediate(MI, Offset)) {
Expr = DIExpression::prepend(Expr, DIExpression::ApplyOffset, Offset);
return ParamLoadedValue(*DestSrc->Source, Expr);
+ } else if (MI.hasOneMemOperand()) {
+ // Only describe memory which provably does not escape the function. As
+ // described in llvm.org/PR43343, escaped memory may be clobbered by the
+ // callee (or by another thread).
+ const auto &TII = MF->getSubtarget().getInstrInfo();
+ const MachineFrameInfo &MFI = MF->getFrameInfo();
+ const MachineMemOperand *MMO = MI.memoperands()[0];
+ const PseudoSourceValue *PSV = MMO->getPseudoValue();
+
+ // If the address points to "special" memory (e.g. a spill slot), it's
+ // sufficient to check that it isn't aliased by any high-level IR value.
+ if (!PSV || PSV->mayAlias(&MFI))
+ return None;
+
+ const auto &TRI = MF->getSubtarget().getRegisterInfo();
+ const MachineOperand *BaseOp;
+ if (!TII->getMemOperandWithOffset(MI, BaseOp, Offset, TRI))
+ return None;
+
+ Expr = DIExpression::prepend(Expr, DIExpression::DerefAfter, Offset);
+ return ParamLoadedValue(*BaseOp, Expr);
}
return None;
OpenPOWER on IntegriCloud