llvm-mirror/test/Assembler/invalid-OperatorConstraint.ll
Joseph Tremoulet 56089ea65e [WinEH] Require token linkage in EH pad/ret signatures
Summary:
WinEHPrepare is going to require that cleanuppad and catchpad produce values
of token type which are consumed by any cleanupret or catchret exiting the
pad.  This change updates the signatures of those operators to require/enforce
that the type produced by the pads is token type and that the rets have an
appropriate argument.

The catchpad argument of a `CatchReturnInst` must be a `CatchPadInst` (and
similarly for `CleanupReturnInst`/`CleanupPadInst`).  To accommodate that
restriction, this change adds a notion of an operator constraint to both
LLParser and BitcodeReader, allowing appropriate sentinels to be constructed
for forward references and appropriate error messages to be emitted for
illegal inputs.

Also add a verifier rule (noted in LangRef) that a catchpad with a catchpad
predecessor must have no other predecessors; this ensures that WinEHPrepare
will see the expected linear relationship between sibling catches on the
same try.

Lastly, remove some superfluous/vestigial casts from instruction operand
setters operating on BasicBlocks.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12108

llvm-svn: 245797
2015-08-23 00:26:33 +00:00

60 lines
2.2 KiB
LLVM

; RUN: sed -e s/.T1:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK1 %s
; RUN: sed -e s/.T2:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s
; RUN: sed -e s/.T3:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s
; RUN: sed -e s/.T4:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK4 %s
; RUN: sed -e s/.T5:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK5 %s
; RUN: sed -e s/.T6:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK6 %s
;T1: define void @f() {
;T1: entry:
;T1: ; operator constraint requires an operator
;T1: catchret undef to label %entry
;T1: ; CHECK1: [[@LINE-1]]:15: error: Catchpad value required in this position
;T1: }
;T2: define void @f() {
;T2: entry:
;T2: %x = cleanuppad []
;T2: ; catchret's first operand's operator must be catchpad
;T2: catchret %x to label %entry
;T2: ; CHECK2: [[@LINE-1]]:15: error: '%x' is not a catchpad
;T2: }
;T3: define void @f() {
;T3: entry:
;T3: ; catchret's first operand's operator must be catchpad
;T3: ; (forward reference case)
;T3: catchret %x to label %next
;T3: ; CHECK3: [[@LINE-1]]:15: error: '%x' is not a catchpad
;T3: next:
;T3: %x = cleanuppad []
;T3: ret void
;T3: }
;T4: define void @f() {
;T4: entry:
;T4: ; operator constraint requires an operator
;T4: cleanupret undef unwind label %entry
;T4: ; CHECK4: [[@LINE-1]]:17: error: Cleanuppad value required in this position
;T4: }
;T5: define void @f() {
;T5: entry:
;T5: %x = catchpad []
;T5: to label %next unwind label %entry
;T5: next:
;T5: ; cleanupret first operand's operator must be cleanuppad
;T5: cleanupret %x unwind to caller
;T5: ; CHECK5: [[@LINE-1]]:17: error: '%x' is not a cleanuppad
;T5: }
;T6: define void @f() {
;T6: entry:
;T6: ; cleanupret's first operand's operator must be cleanuppad
;T6: ; (forward reference case)
;T6: cleanupret %x unwind label %next
;T6: ; CHECK6: [[@LINE-1]]:17: error: '%x' is not a cleanuppad
;T6: next:
;T6: %x = catchpad [] to label %entry unwind label %next
;T6: }