Update checks in advance of an update to D68233.

In the past, the IR Verifier would bail out at the first broken function
it found. This required trickery with sed to put multiple broken functions
in a single test file.

Now, the Verifier allows for multiple broken functions. The sed trickery
is no longer needed. I've eliminated it.

I've also split the test into two since one of them passes verification
and we need to look at the output IR from 'opt'. The other fails and we
need to look at the diagnostics printed by the Verifier.
This commit is contained in:
Kevin P. Neal 2023-03-21 13:54:42 -04:00
parent a37df84f99
commit 2bd4130362
2 changed files with 80 additions and 63 deletions

View File

@ -0,0 +1,43 @@
; RUN: opt -passes=verify -S < %s 2>&1 | FileCheck %s
declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #0
declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #0
; Test that the verifier accepts legal code, and that the correct attributes are
; attached to the FP intrinsic. The attributes are checked at the bottom.
; CHECK: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]]
; CHECK: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
; Note: FP exceptions aren't usually caught through normal unwind mechanisms,
; but we may want to revisit this for asynchronous exception handling.
define double @f1(double %a, double %b) #0 {
; CHECK-LABEL: define double @f1
; CHECK-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR1:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FADD:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[A]], double [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR1]]
; CHECK-NEXT: ret double [[FADD]]
entry:
%fadd = call double @llvm.experimental.constrained.fadd.f64(
double %a, double %b,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret double %fadd
}
define double @f1u(double %a) #0 {
; CHECK-LABEL: define double @f1u
; CHECK-SAME: (double [[A:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FSQRT:%.*]] = call double @llvm.experimental.constrained.sqrt.f64(double [[A]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR1]]
; CHECK-NEXT: ret double [[FSQRT]]
;
entry:
%fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
double %a,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret double %fsqrt
}
attributes #0 = { strictfp }
; TODO: Why is strictfp not in the below list?
; CHECK: attributes #[[ATTR]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }

View File

@ -1,80 +1,54 @@
; RUN: opt -passes=verify -S < %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
; RUN: sed -e s/.T2:// %s | not opt -passes=verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s
; RUN: sed -e s/.T3:// %s | not opt -passes=verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s
; RUN: sed -e s/.T4:// %s | not opt -passes=verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK4 %s
; RUN: sed -e s/.T5:// %s | not opt -passes=verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK5 %s
; RUN: not opt -passes=verify -disable-output < %s 2>&1 | FileCheck %s
; Common declarations used for all runs.
declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
; Test that the verifier accepts legal code, and that the correct attributes are
; attached to the FP intrinsic.
; CHECK1: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]]
; CHECK1: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
; CHECK1: attributes #[[ATTR]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; Note: FP exceptions aren't usually caught through normal unwind mechanisms,
; but we may want to revisit this for asynchronous exception handling.
define double @f1(double %a, double %b) #0 {
; Test an illegal value for the rounding mode argument.
; CHECK: invalid rounding mode argument
; CHECK-NEXT: %fadd = call double @llvm.experimental.constrained.fadd.f64(double %a, double %b, metadata !"round.dynomic", metadata !"fpexcept.strict") #1
define double @f2(double %a, double %b) #0 {
entry:
%fadd = call double @llvm.experimental.constrained.fadd.f64(
double %a, double %b,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
double %a, double %b,
metadata !"round.dynomic",
metadata !"fpexcept.strict") #0
ret double %fadd
}
define double @f1u(double %a) #0 {
; Test an illegal value for the exception behavior argument.
; CHECK-NEXT: invalid exception behavior argument
; CHECK-NEXT: %fadd = call double @llvm.experimental.constrained.fadd.f64(double %a, double %b, metadata !"round.dynamic", metadata !"fpexcept.restrict") #1
define double @f3(double %a, double %b) #0 {
entry:
%fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
double %a,
metadata !"round.dynamic",
metadata !"fpexcept.strict") #0
ret double %fsqrt
%fadd = call double @llvm.experimental.constrained.fadd.f64(
double %a, double %b,
metadata !"round.dynamic",
metadata !"fpexcept.restrict") #0
ret double %fadd
}
; Test an illegal value for the rounding mode argument.
; CHECK2: invalid rounding mode argument
;T2: define double @f2(double %a, double %b) #0 {
;T2: entry:
;T2: %fadd = call double @llvm.experimental.constrained.fadd.f64(
;T2: double %a, double %b,
;T2: metadata !"round.dynomite",
;T2: metadata !"fpexcept.strict") #0
;T2: ret double %fadd
;T2: }
; CHECK-NEXT: invalid rounding mode argument
; CHECK-NEXT: %fadd = call double @llvm.experimental.constrained.sqrt.f64(double %a, metadata !"round.dynomic", metadata !"fpexcept.strict") #1
define double @f4(double %a) #0 {
entry:
%fadd = call double @llvm.experimental.constrained.sqrt.f64(
double %a,
metadata !"round.dynomic",
metadata !"fpexcept.strict") #0
ret double %fadd
}
; Test an illegal value for the exception behavior argument.
; CHECK3: invalid exception behavior argument
;T3: define double @f3(double %a, double %b) #0 {
;T3: entry:
;T3: %fadd = call double @llvm.experimental.constrained.fadd.f64(
;T3: double %a, double %b,
;T3: metadata !"round.dynamic",
;T3: metadata !"fpexcept.restrict") #0
;T3: ret double %fadd
;T3: }
; Test an illegal value for the rounding mode argument.
; CHECK4: invalid rounding mode argument
;T4: define double @f4(double %a) #0 {
;T4: entry:
;T4: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
;T4: double %a,
;T4: metadata !"round.dynomite",
;T4: metadata !"fpexcept.strict") #0
;T4: ret double %fadd
;T4: }
; Test an illegal value for the exception behavior argument.
; CHECK5: invalid exception behavior argument
;T5: define double @f5(double %a) #0 {
;T5: entry:
;T5: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
;T5: double %a,
;T5: metadata !"round.dynamic",
;T5: metadata !"fpexcept.restrict") #0
;T5: ret double %fadd
;T5: }
; CHECK-NEXT: invalid exception behavior argument
; CHECK-NEXT: %fadd = call double @llvm.experimental.constrained.sqrt.f64(double %a, metadata !"round.dynamic", metadata !"fpexcept.restrict") #1
define double @f5(double %a) #0 {
entry:
%fadd = call double @llvm.experimental.constrained.sqrt.f64(
double %a,
metadata !"round.dynamic",
metadata !"fpexcept.restrict") #0
ret double %fadd
}
attributes #0 = { strictfp }