mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[DebugInfo][LCSSA] Preserve debug location in lcssa phis
Summary: When inserting lcssa Phi Nodes in the exit block mak sure to preserve the original instructions DL. Reviewers: vsk Subscribers: JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D50009 llvm-svn: 338391
This commit is contained in:
parent
fa008c0805
commit
ab84cfb37d
@ -144,7 +144,8 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
|
|||||||
|
|
||||||
PHINode *PN = PHINode::Create(I->getType(), PredCache.size(ExitBB),
|
PHINode *PN = PHINode::Create(I->getType(), PredCache.size(ExitBB),
|
||||||
I->getName() + ".lcssa", &ExitBB->front());
|
I->getName() + ".lcssa", &ExitBB->front());
|
||||||
|
// Get the debug location from the original instruction.
|
||||||
|
PN->setDebugLoc(I->getDebugLoc());
|
||||||
// Add inputs from inside the loop for this PHI.
|
// Add inputs from inside the loop for this PHI.
|
||||||
for (BasicBlock *Pred : PredCache.get(ExitBB)) {
|
for (BasicBlock *Pred : PredCache.get(ExitBB)) {
|
||||||
PN->addIncoming(I, Pred);
|
PN->addIncoming(I, Pred);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; RUN: opt < %s -lcssa -S | FileCheck %s
|
; RUN: opt < %s -lcssa -S | FileCheck %s
|
||||||
; RUN: opt < %s -passes=lcssa -S | FileCheck %s
|
; RUN: opt < %s -passes=lcssa -S | FileCheck %s
|
||||||
; RUN: opt < %s -debugify -lcssa -S | FileCheck -check-prefix=CHECK2 %s
|
; RUN: opt < %s -debugify -lcssa -S | FileCheck -check-prefix=DEBUGIFY %s
|
||||||
|
|
||||||
define void @lcssa(i1 %S2) {
|
define void @lcssa(i1 %S2) {
|
||||||
; CHECK-LABEL: @lcssa
|
; CHECK-LABEL: @lcssa
|
||||||
@ -19,9 +19,12 @@ post.if: ; preds = %if.false, %if.true
|
|||||||
br i1 %S2, label %loop.exit, label %loop.interior
|
br i1 %S2, label %loop.exit, label %loop.interior
|
||||||
loop.exit: ; preds = %post.if
|
loop.exit: ; preds = %post.if
|
||||||
; CHECK: %X3.lcssa = phi i32
|
; CHECK: %X3.lcssa = phi i32
|
||||||
; CHECK2: call void @llvm.dbg.value(metadata i32 %X3.lcssa
|
; DEBUGIFY: %X3.lcssa = phi i32 {{.*}}, !dbg ![[DbgLoc:[0-9]+]]
|
||||||
|
; DEBUGIFY-NEXT: call void @llvm.dbg.value(metadata i32 %X3.lcssa
|
||||||
; CHECK: %X4 = add i32 3, %X3.lcssa
|
; CHECK: %X4 = add i32 3, %X3.lcssa
|
||||||
%X4 = add i32 3, %X3 ; <i32> [#uses=0]
|
%X4 = add i32 3, %X3 ; <i32> [#uses=0]
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; Make sure the lcssa phi has %X3's debug location
|
||||||
|
; DEBUGIFY: ![[DbgLoc]] = !DILocation(line: 7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user