mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[Debugify] Don't insert debug values after terminating deopts
As is the case with musttail calls, the IR does not allow for instructions inserted after a terminating deopt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
; RUN: llc < %s | FileCheck %s
|
||||
; RUN: llc -debug-only=stackmaps < %s 2>&1 | FileCheck --check-prefix=STACKMAPS %s
|
||||
; RUN: opt -disable-output -debugify < %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
||||
+14
-5
@@ -39,6 +39,19 @@ bool isFunctionSkipped(Function &F) {
|
||||
return F.isDeclaration() || !F.hasExactDefinition();
|
||||
}
|
||||
|
||||
/// Find a suitable insertion point for debug values intrinsics.
|
||||
///
|
||||
/// These must be inserted before the terminator. Special care is needed to
|
||||
/// handle musttail and deopt calls, as these behave like (but are in fact not)
|
||||
/// terminators.
|
||||
Instruction *findDebugValueInsertionPoint(BasicBlock &BB) {
|
||||
if (auto *I = BB.getTerminatingMustTailCall())
|
||||
return I;
|
||||
if (auto *I = BB.getTerminatingDeoptimizeCall())
|
||||
return I;
|
||||
return BB.getTerminator();
|
||||
}
|
||||
|
||||
bool applyDebugifyMetadata(Module &M,
|
||||
iterator_range<Module::iterator> Functions,
|
||||
StringRef Banner) {
|
||||
@@ -91,11 +104,7 @@ bool applyDebugifyMetadata(Module &M,
|
||||
if (BB.isEHPad())
|
||||
continue;
|
||||
|
||||
// Debug values must be inserted before a musttail call (if one is
|
||||
// present), or before the block terminator otherwise.
|
||||
Instruction *LastInst = BB.getTerminatingMustTailCall();
|
||||
if (!LastInst)
|
||||
LastInst = BB.getTerminator();
|
||||
Instruction *LastInst = findDebugValueInsertionPoint(BB);
|
||||
|
||||
// Attach debug values.
|
||||
for (auto It = BB.begin(), End = LastInst->getIterator(); It != End;
|
||||
|
||||
Reference in New Issue
Block a user