Issue 109401
Summary [SPIR-V] Backend emits invalid types in OpPhi
Labels new issue
Assignees VyacheslavLevytskyy
Reporter VyacheslavLevytskyy
    SPIR-V Backend emits invalid types in OpPhi in the following reproducer:

```
define ptr @foo(i1 %arg) {
entry:
  br i1 %arg, label %if.then.i, label %if.end.i

if.then.i:
  %r1 = tail call ptr @f1()
  br label %exit

if.end.i:
  %r2 = tail call ptr @f2()
  br label %exit

exit:
  %ret = phi ptr [ %r1, %if.then.i ], [ %r2, %if.end.i ]
  ret ptr %ret
}

define ptr @f1() {
entry:
  %p = alloca i8
  store i8 8, ptr %p
  ret ptr %p
}

define ptr @f2() {
entry:
  %p = alloca i32
  store i32 32, ptr %p
  ret ptr %p
}
```

spirv-val output:

```
$ spirv-val 1.spv
error: line 41: OpPhi's result type <id> '4[%_ptr_Function_uchar]' does not match incoming value <id> '15[%r2]' type <id> '8[%_ptr_Function_uint]'.
  %ret = OpPhi %_ptr_Function_uchar %r1 %22 %r2 %23
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to