summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-12-08 22:33:23 +0000
committerReid Kleckner <rnk@google.com>2015-12-08 22:33:23 +0000
commite18f92bfe956e9229a81473ed29e9a577177a77a (patch)
tree4065527a1a414a1f860015794cf1c62423e35d72
parent8a954a055339f431409560658159cb50697f46a2 (diff)
downloadbcm5719-llvm-e18f92bfe956e9229a81473ed29e9a577177a77a.tar.gz
bcm5719-llvm-e18f92bfe956e9229a81473ed29e9a577177a77a.zip
Revert "[CGP] Check that we have an insert point before moving llvm.dbg.value around"
This reverts commit r255055. Breakage has been reported. llvm-svn: 255063
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp12
-rw-r--r--llvm/test/Transforms/CodeGenPrepare/catchpad-phi-cast.ll57
2 files changed, 4 insertions, 65 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 615bcf33767..d619044e86c 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5251,16 +5251,12 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
Instruction *VI = dyn_cast_or_null<Instruction>(DVI->getValue());
if (VI && VI != PrevNonDbgInst && !VI->isTerminator()) {
- BasicBlock::iterator IP;
- if (isa<PHINode>(VI))
- IP = VI->getParent()->getFirstInsertionPt();
- else
- IP = ++VI->getIterator();
- if (IP == VI->getParent()->end())
- continue;
DEBUG(dbgs() << "Moving Debug Value before :\n" << *DVI << ' ' << *VI);
DVI->removeFromParent();
- VI->getParent()->getInstList().insert(IP, DVI);
+ if (isa<PHINode>(VI))
+ DVI->insertBefore(&*VI->getParent()->getFirstInsertionPt());
+ else
+ DVI->insertAfter(VI);
MadeChange = true;
++NumDbgValueMoved;
}
diff --git a/llvm/test/Transforms/CodeGenPrepare/catchpad-phi-cast.ll b/llvm/test/Transforms/CodeGenPrepare/catchpad-phi-cast.ll
index c0b63b7d6d9..998ca7069c8 100644
--- a/llvm/test/Transforms/CodeGenPrepare/catchpad-phi-cast.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/catchpad-phi-cast.ll
@@ -10,7 +10,6 @@ declare i32 @__CxxFrameHandler3(...)
declare void @f()
declare void @g(i8*)
-declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
; CodeGenPrepare will want to sink these bitcasts, but it selects the catchpad
; blocks as the place to which the bitcast should be sunk. Since catchpads
@@ -58,59 +57,3 @@ catchend1:
catchend2:
catchendpad unwind to caller
}
-
-; CodeGenPrepare will want to hoist these llvm.dbg.value calls to the phi, but
-; there is no insertion point in a catchpad block.
-
-; CHECK-LABEL: @test_dbg_value(
-define void @test_dbg_value() personality i32 (...)* @__CxxFrameHandler3 {
-entry:
- %a = alloca i8
- %b = alloca i8
- invoke void @f() to label %next unwind label %catch.dispatch
-next:
- invoke void @f() to label %ret unwind label %catch.dispatch
-ret:
- ret void
-
-catch.dispatch:
- %p = phi i8* [%a, %entry], [%b, %next]
- %cp1 = catchpad [] to label %catch unwind label %catchend
-
-catch:
- tail call void @llvm.dbg.value(metadata i8* %p, i64 0, metadata !11, metadata !13), !dbg !14
- invoke void @g(i8* %p) to label %catchret unwind label %catchend
-catchret:
- catchret %cp1 to label %ret
-
-; CHECK: catch.dispatch:
-; CHECK-NEXT: phi i8
-; CHECK-NEXT: catchpad
-; CHECK-NOT: llvm.dbg.value
-
-; CHECK: catch:
-; CHECK-NEXT: call void @llvm.dbg.value
-
-catchend:
- catchendpad unwind to caller
-}
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!7, !8, !9}
-!llvm.ident = !{!10}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 254906) (llvm/trunk 254917)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: null, subprograms: !3)
-!1 = !DIFile(filename: "t.c", directory: "D:\5Csrc\5Cllvm\5Cbuild")
-!3 = !{!4}
-!4 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, variables: null)
-!5 = !DISubroutineType(types: !6)
-!6 = !{null}
-!7 = !{i32 2, !"Dwarf Version", i32 4}
-!8 = !{i32 2, !"Debug Info Version", i32 3}
-!9 = !{i32 1, !"PIC Level", i32 2}
-!10 = !{!"clang version 3.8.0 (trunk 254906) (llvm/trunk 254917)"}
-!11 = !DILocalVariable(name: "p", scope: !4, file: !1, line: 2, type: !12)
-!12 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
-!13 = !DIExpression()
-!14 = !DILocation(line: 2, column: 8, scope: !4)
-!15 = !DILocation(line: 3, column: 1, scope: !4)
OpenPOWER on IntegriCloud