[Verifier] Resume instructions can only be in functions w/ a personality

This fixes PR28799.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277360 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2016-08-01 18:06:34 +00:00
parent c54b1ec0f8
commit 6687e3a1ed
2 changed files with 17 additions and 1 deletions

View File

@ -428,6 +428,7 @@ private:
void visitInsertValueInst(InsertValueInst &IVI);
void visitEHPadPredecessors(Instruction &I);
void visitLandingPadInst(LandingPadInst &LPI);
void visitResumeInst(ResumeInst &RI);
void visitCatchPadInst(CatchPadInst &CPI);
void visitCatchReturnInst(CatchReturnInst &CatchReturn);
void visitCleanupPadInst(CleanupPadInst &CPI);
@ -3298,6 +3299,21 @@ void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
visitInstruction(LPI);
}
void Verifier::visitResumeInst(ResumeInst &RI) {
Assert(RI.getFunction()->hasPersonalityFn(),
"ResumeInst needs to be in a function with a personality.", &RI);
if (!LandingPadResultTy)
LandingPadResultTy = RI.getValue()->getType();
else
Assert(LandingPadResultTy == RI.getValue()->getType(),
"The resume instruction should have a consistent result type "
"inside a function.",
&RI);
visitTerminatorInst(RI);
}
void Verifier::visitCatchPadInst(CatchPadInst &CPI) {
BasicBlock *BB = CPI.getParent();

View File

@ -341,7 +341,7 @@ msgSend.cont507: ; preds = %msgSend.nullinit506
}
; Function Attrs: optsize ssp uwtable
define void @test2() unnamed_addr align 2 {
define void @test2() unnamed_addr align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
bb:
br i1 undef, label %bb3, label %bb2