DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

When using "--variable" as an argument to an inout function, 2 is subtracted not one

Open AdamJMiles opened this issue 3 years ago • 2 comments

https://godbolt.org/z/73so7qzzW

void Func(inout uint byteOffset) { }

uint PSMain(uint i : I) : SV_TARGET { Func(--i); // Subtracts 2... return i; }

The resulting DXIL has an "Add minus two" operation, not "add minus one".

%2 = add i32 %1, -2, !dbg !37

AdamJMiles avatar Dec 12 '22 19:12 AdamJMiles

Assigning to myself to check against my development branch that is rewriting parameter passing.

llvm-beanz avatar Jul 08 '23 00:07 llvm-beanz

This will be fixed by #5377. I've verified this is fixed against the draft PR #5249. I'll keep this assigned to me to construct a test case to include with the final PR.

llvm-beanz avatar Jul 08 '23 13:07 llvm-beanz