[llvm] r262364 - [Verifier] Don't abort on invalid cleanuprets
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 1 10:59:50 PST 2016
Author: majnemer
Date: Tue Mar 1 12:59:50 2016
New Revision: 262364
URL: http://llvm.org/viewvc/llvm-project?rev=262364&view=rev
Log:
[Verifier] Don't abort on invalid cleanuprets
Code in visitEHPadPredecessors assume a little too much about the
validity of a cleanupret with an invalid cleanuppad operand.
Modified:
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/test/Verifier/invalid-eh.ll
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=262364&r1=262363&r2=262364&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Tue Mar 1 12:59:50 2016
@@ -3055,7 +3055,7 @@ void Verifier::visitEHPadPredecessors(In
else
FromPad = ConstantTokenNone::get(II->getContext());
} else if (auto *CRI = dyn_cast<CleanupReturnInst>(TI)) {
- FromPad = CRI->getCleanupPad();
+ FromPad = CRI->getOperand(0);
Assert(FromPad != ToPadParent, "A cleanupret must exit its cleanup", CRI);
} else if (auto *CSI = dyn_cast<CatchSwitchInst>(TI)) {
FromPad = CSI;
Modified: llvm/trunk/test/Verifier/invalid-eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/invalid-eh.ll?rev=262364&r1=262363&r2=262364&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/invalid-eh.ll (original)
+++ llvm/trunk/test/Verifier/invalid-eh.ll Tue Mar 1 12:59:50 2016
@@ -23,6 +23,7 @@
; RUN: sed -e s/.T23:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK23 %s
; RUN: sed -e s/.T24:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK24 %s
; RUN: sed -e s/.T25:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK25 %s
+; RUN: sed -e s/.T26:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK26 %s
declare void @g()
@@ -439,3 +440,17 @@ declare void @g()
;T25: %cp3 = cleanuppad within none []
;T25: cleanupret from %cp3 unwind to caller
;T25: }
+
+;T26: define void @f() personality void ()* @g {
+;T26: entry:
+;T26: ret void
+;T26:
+;T26: ehcleanup:
+;T26: cleanuppad within none []
+;T26: cleanupret from none unwind label %ehcleanup
+;T26: ; CHECK26: A cleanupret must exit its cleanup
+;T26: ; CHECK26: cleanupret from none unwind label %ehcleanup
+;T26: ; CHECK26: CleanupReturnInst needs to be provided a CleanupPad
+;T26: ; CHECK26: cleanupret from none unwind label %ehcleanup
+;T26: ; CHECK26: token none
+;T26: }
More information about the llvm-commits
mailing list