[llvm] r323482 - [Debug] LCSSA: Insert dbg.value at the first available insertion point
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 15:48:29 PST 2018
Author: vedantk
Date: Thu Jan 25 15:48:29 2018
New Revision: 323482
URL: http://llvm.org/viewvc/llvm-project?rev=323482&view=rev
Log:
[Debug] LCSSA: Insert dbg.value at the first available insertion point
Inserting a dbg.value instruction at the start of a basic block with a
landingpad instruction triggers a verifier failure. We should be OK if
we insert the instruction a bit later.
Speculative fix for the bot failure described here:
https://reviews.llvm.org/D42551
Modified:
llvm/trunk/lib/Transforms/Utils/Local.cpp
llvm/trunk/test/Transforms/LCSSA/basictest.ll
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=323482&r1=323481&r2=323482&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Thu Jan 25 15:48:29 2018
@@ -1373,7 +1373,9 @@ void llvm::insertDebugValuesForPHIs(Basi
auto PhiMAV = MetadataAsValue::get(C, ValueAsMetadata::get(PHI));
NewDbgII->setOperand(0, PhiMAV);
BasicBlock *Parent = PHI->getParent();
- NewDbgII->insertBefore(Parent->getFirstNonPHIOrDbgOrLifetime());
+ auto InsertionPt = Parent->getFirstInsertionPt();
+ assert(InsertionPt != Parent->end() && "Ill-formed basic block");
+ NewDbgII->insertBefore(&*InsertionPt);
}
}
}
Modified: llvm/trunk/test/Transforms/LCSSA/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LCSSA/basictest.ll?rev=323482&r1=323481&r2=323482&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LCSSA/basictest.ll (original)
+++ llvm/trunk/test/Transforms/LCSSA/basictest.ll Thu Jan 25 15:48:29 2018
@@ -19,8 +19,11 @@ post.if: ; preds = %if.false, %if.true
br i1 %S2, label %loop.exit, label %loop.interior
loop.exit: ; preds = %post.if
; CHECK: %X3.lcssa = phi i32
-; CHECK2: call void @llvm.dbg.value(metadata i32 %X3.lcssa, metadata !11, metadata !DIExpression()), !dbg !19
; CHECK: %X4 = add i32 3, %X3.lcssa
+
+; CHECK2: call void @llvm.dbg.value(metadata i32 %X3.lcssa, metadata !11, metadata !DIExpression()), !dbg !19
+; CHECK2-NEXT: add i32 3, %X3.lcssa
+; CHECK2: ret void
%X4 = add i32 3, %X3 ; <i32> [#uses=0]
ret void
}
More information about the llvm-commits
mailing list