Skip to content

id decorated twice with the same decoration #3410

@maarquitos14

Description

@maarquitos14
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

define void @foo(float %1, float %2) {
entry:
  %oltRes = fcmp nnan olt float %1,  %2, !spirv.Decorations !1
  ret void
}

!1 = !{!2}
!2 = !{i32 40, i32 0} ; 40 is FPFastMathMode

The code above results in the following SPIR-V Module:

119734787 67072 393230 11 0
2 Capability Addresses
2 Capability Linkage
2 Capability Kernel
5 ExtInstImport 1 "OpenCL.std"
3 MemoryModel 1 2
3 Source 0 0
3 Name 5 "foo"
4 Name 8 "entry"
4 Name 10 "oltRes"
5 Decorate 5 LinkageAttributes "foo" Export
4 Decorate 10 FPFastMathMode 1
4 Decorate 10 FPFastMathMode 0
2 TypeVoid 2
3 TypeFloat 3 32
5 TypeFunction 4 2 3 3
2 TypeBool 9


5 Function 2 5 0 4
3 FunctionParameter 3 6
3 FunctionParameter 3 7

2 Label 8
5 FOrdLessThan 9 10 6 7
1 Return

1 FunctionEnd

The module contains FPFastMathMode decoration twice for id 10. According to the spec

It is invalid to decorate any given or structure member more than one time with the same decoration, unless explicitly allowed below for a specific decoration.

FPFastMathMode does not explicitly allow it, so this is illegal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions