[llvm] [DirectX][DXIL] Distinguish return type for overload type resolution. (PR #85646)
Chris B via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 13:49:51 PDT 2024
================
@@ -398,10 +398,20 @@ static void emitDXILOperationTable(std::vector<DXILOperationDesc> &Ops,
OS << " static const OpCodeProperty OpCodeProps[] = {\n";
for (auto &Op : Ops) {
+ // Consider Op.OverloadParamIndex as the overload parameter index, by
+ // default
+ auto OLParamIdx = Op.OverloadParamIndex;
+ // If no overload parameter index is set, treat first parameter type as
+ // overload type - unless the Op has no parameters, in which case treat the
+ // return type - as overload parameter to emit the appropriate overload kind
+ // enum.
+ if (OLParamIdx < 0) {
+ OLParamIdx = (Op.OpTypes.size() > 1) ? 1 : 0;
+ }
----------------
llvm-beanz wrote:
I think this still might not be right. Take for example a barrier intrinsic. It takes 0 parameters, returns void. It has no overload type at all:
```llvm
define void @"\01?barrier_wrapper@@YAXXZ"() #0 {
call void @dx.op.barrier(i32 80, i32 9), !dbg !20 ; line:2 col:3 ; Barrier(barrierMode)
ret void, !dbg !21 ; line:3 col:1
}
```
https://godbolt.org/z/49fW8hKh5
Are there any cases where the overload isn't the first parameter and we have an overload type?
https://github.com/llvm/llvm-project/pull/85646
More information about the llvm-commits
mailing list