[llvm] [DirectX][DXIL] Distinguish return type for overload type resolution. (PR #85646)
Chris B via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 19 07:40:32 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:
Thanks @python3kgae!
So supporting the index being arbitrary is necessary.
I still can't think of any case where we have no parameters and an overload type, so if `Op.OpTypes.size() == 0` we should just not have an overload rather than overloading to the return type.
The cases where we overload on return type like `bufferLoad` and `cbufferLoadLegacy` all have parameters (see: https://godbolt.org/z/b5dn1ncvW).
https://github.com/llvm/llvm-project/pull/85646
More information about the llvm-commits
mailing list