diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp index fa4a03b8848..ae182bd947d 100644 --- a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp +++ b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp @@ -372,8 +372,9 @@ void SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) { } Value *Exec = popSaved(); - if (!isa<UndefValue>(Exec)) - CallInst::Create(EndCf, Exec, "", &*BB->getFirstInsertionPt()); + Instruction *FirstInsertionPt = &*BB->getFirstInsertionPt(); + if (!isa<UndefValue>(Exec) && !isa<UnreachableInst>(FirstInsertionPt)) + CallInst::Create(EndCf, Exec, "", FirstInsertionPt); } /// \brief Annotate the control flow with intrinsics so the backend can |

