From 6394df9fc48b26c65cf525d92500c5b43ba81fdc Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 25 Jan 2018 23:48:29 +0000 Subject: [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 llvm-svn: 323482 --- llvm/lib/Transforms/Utils/Local.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Utils/Local.cpp') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index a7eaffd1a7a..337ee0e9ef5 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1373,7 +1373,9 @@ void llvm::insertDebugValuesForPHIs(BasicBlock *BB, 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); } } } -- cgit v1.2.3