aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PHIElimination.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2021-04-20 13:26:40 -0700
committerAdrian Prantl <aprantl@apple.com>2021-04-20 17:03:29 -0700
commit81cad0be687e3db027b6035e2193a805eb1b6ced (patch)
treeb60a11d967482f54e0762bcf11bf371ee54869bb /llvm/lib/CodeGen/PHIElimination.cpp
parent103956170b8e4c3b4843f6db990b1a0404b0ac32 (diff)
downloadllvm-81cad0be687e3db027b6035e2193a805eb1b6ced.zip
llvm-81cad0be687e3db027b6035e2193a805eb1b6ced.tar.gz
llvm-81cad0be687e3db027b6035e2193a805eb1b6ced.tar.bz2
Make sure PHIElimination doesn't copy debug locations across basic blocks.
PHIElimination may insert copy instructions in multiple basic blocks. Moving debug locations across basic block boundaries would be misleading as illustrated by the test case. rdar://75463656 Differential Revision: https://reviews.llvm.org/D100886
Diffstat (limited to 'llvm/lib/CodeGen/PHIElimination.cpp')
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index b8e2b57..bd586ef 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -475,9 +475,10 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
if (DefMI->isImplicitDef())
ImpDefs.insert(DefMI);
} else {
- NewSrcInstr =
- TII->createPHISourceCopy(opBlock, InsertPos, MPhi->getDebugLoc(),
- SrcReg, SrcSubReg, IncomingReg);
+ // Delete the debug location, since the copy is inserted into a
+ // different basic block.
+ NewSrcInstr = TII->createPHISourceCopy(opBlock, InsertPos, nullptr,
+ SrcReg, SrcSubReg, IncomingReg);
}
}