Issue 81753
Summary [SPIRV] OpExecutionMode Entry Point <id> is not the Entry Point operand of an OpEntryPoint
Labels new issue
Assignees
Reporter VyacheslavLevytskyy
    SPIRV-V Backend generates unnecessary OpExecutionMode records, putting into the <id>'s which are not the Entry Point operands of an OpEntryPoint and thus violating specification requirements (https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpExecutionMode).

Example of the code that causes one more, unnecessary OpExecutionMode record in addition to a required one is the following:

```
@GV = linkonce_odr addrspace(1) global [3 x i32] zeroinitializer, align 4

define spir_kernel void @k() {
entry:
  %call = call spir_func i32 @square(i32 2)
  ret void
}

define linkonce_odr dso_local spir_func i32 @square(i32 %in) {
entry:
  %in.addr = alloca i32, align 4
  store i32 %in, i32* %in.addr, align 4
  %0 = load i32, i32* %in.addr, align 4
  %1 = load i32, i32* %in.addr, align 4
  %mul = mul nsw i32 %0, %1
  ret i32 %mul
}
```

In the output there will be two OpExecutionMode instructions with just one OpEntryPoint:

```
...
        OpEntryPoint Kernel %14 "k" %12
        OpExecutionMode %14 ContractionOff
        OpExecutionMode %17 ContractionOff
...
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to