summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp14
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfo.cpp9
2 files changed, 10 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index d38840b7d8a..b15c594a454 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -997,14 +997,10 @@ void LiveDebugValues::transferRegisterCopy(MachineInstr &MI,
OpenRangesSet &OpenRanges,
VarLocMap &VarLocIDs,
TransferMap &Transfers) {
+ const MachineOperand *SrcRegOp, *DestRegOp;
- auto DestSrc = TII->isCopyInstr(MI);
- if (!DestSrc)
- return;
-
- const MachineOperand &DestRegOp = DestSrc->Destination;
- const MachineOperand &SrcRegOp = DestSrc->Source;
- if (!SrcRegOp.isKill() || !DestRegOp.isDef())
+ if (!TII->isCopyInstr(MI, SrcRegOp, DestRegOp) || !SrcRegOp->isKill() ||
+ !DestRegOp->isDef())
return;
auto isCalleeSavedReg = [&](unsigned Reg) {
@@ -1014,8 +1010,8 @@ void LiveDebugValues::transferRegisterCopy(MachineInstr &MI,
return false;
};
- Register SrcReg = SrcRegOp.getReg();
- Register DestReg = DestRegOp.getReg();
+ Register SrcReg = SrcRegOp->getReg();
+ Register DestReg = DestRegOp->getReg();
// We want to recognize instructions where destination register is callee
// saved register. If register that could be clobbered by the call is
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index f5f53b50ab8..88fbfcb7784 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1124,13 +1124,14 @@ Optional<ParamLoadedValue>
TargetInstrInfo::describeLoadedValue(const MachineInstr &MI) const {
const MachineFunction *MF = MI.getMF();
DIExpression *Expr = DIExpression::get(MF->getFunction().getContext(), {});
+ const MachineOperand *SrcRegOp, *DestRegOp;
int64_t Offset;
- if (auto DestSrc = isCopyInstr(MI)) {
- return ParamLoadedValue(DestSrc->Source, Expr);
- } else if (auto DestSrc = isAddImmediate(MI, Offset)) {
+ if (isCopyInstr(MI, SrcRegOp, DestRegOp)) {
+ return ParamLoadedValue(*SrcRegOp, Expr);
+ } else if (isAddImmediate(MI, DestRegOp, SrcRegOp, Offset)) {
Expr = DIExpression::prepend(Expr, DIExpression::ApplyOffset, Offset);
- return ParamLoadedValue(DestSrc->Source, Expr);
+ return ParamLoadedValue(*SrcRegOp, Expr);
}
return None;
OpenPOWER on IntegriCloud