Skip to content

Commit

Permalink
Reverting changes in tests
Browse files Browse the repository at this point in the history
Possible now that considerations for the extraneous cases have been
taken.
  • Loading branch information
venkataram-nv committed Jul 5, 2024
1 parent 18e88b9 commit bd5742c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
14 changes: 10 additions & 4 deletions source/slang/slang-ir-use-uninitialized-values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ namespace Slang
case kIROp_FieldAddress:
case kIROp_GetElement:
case kIROp_GetElementPtr:
// TODO: array index
return true;
default:
break;
Expand Down Expand Up @@ -104,13 +103,14 @@ namespace Slang
if (as<IRVoidType>(type))
return true;

if (as<IRBoolType>(type))
return true;

// For structs, ignore if its empty
if (as<IRStructType>(type))
return (type->getFirstChild() == nullptr);

// Nothing to initialize for a pure interface
if (as<IRInterfaceType>(type))
return true;

return false;
}

Expand Down Expand Up @@ -182,6 +182,12 @@ namespace Slang
stores.add(user->getParent());
break;

case kIROp_MakeExistential:
case kIROp_MakeExistentialWithRTTI:
// For specializing generic structs
stores.add(user);
break;

// ... and the rest will load/use them
default:
loads.add(user);
Expand Down
6 changes: 1 addition & 5 deletions tests/bugs/gh-1990.slang
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ struct StandardBSDF : IBSDF
struct StandardMaterial : IMaterial
{
typedef StandardBSDF BSDF;
StandardBSDF setupBSDF()
{
StandardBSDF g = StandardBSDF();
return g;
}
StandardBSDF setupBSDF() { StandardBSDF g; return g; }
};

//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=gOutputBuffer
Expand Down
2 changes: 1 addition & 1 deletion tests/bugs/interface-type-self-ref.slang
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ int f(IFoo p)
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
Impl impl = Impl();
Impl impl;
outputBuffer[index] = f(impl);
}
2 changes: 1 addition & 1 deletion tests/bugs/specialize-existential-in-generic.slang
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface IFoo
struct Impl : IFoo
{
struct Assoc : IAssoc { int getInner() { return 1; } }
Assoc getValue() { Assoc r = Assoc(); return r; }
Assoc getValue() { Assoc r; return r; }
}

struct GenType<T : IFoo>
Expand Down
4 changes: 2 additions & 2 deletions tests/diagnostics/no-type-conformance.slang
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ interface IFoo

void foo()
{
IFoo obj = IFoo();
IFoo obj;
obj.get();
}

[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
foo();
}
}
2 changes: 1 addition & 1 deletion tests/experiments/generic/type-to-value-4.slang
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{

// Err.. even though IGetE doesn't require an instanciation, not clear how to set it. So lets try with instanciation
B b = B();
B b;
IGetE g = b;

let e = g.getE();
Expand Down
2 changes: 1 addition & 1 deletion tests/language-feature/generics/generic-interface-2.slang
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RWStructuredBuffer<int> outputBuffer;
[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
MyType<3> t = MyType<3>();
MyType<3> t;
test(t);
// CHECK: 3
outputBuffer[0] = test(t);
Expand Down
4 changes: 2 additions & 2 deletions tests/language-feature/if-let/if-let-1.slang
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ int test1<T>(T t)
[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
MyImpl1 impl1 = MyImpl1();
MyImpl2 impl2 = MyImpl2();
MyImpl1 impl1;
MyImpl2 impl2;
// CHECK: 1
// CHECK: 7
outputBuffer[0] = test(impl1, 1);
Expand Down
2 changes: 1 addition & 1 deletion tests/language-feature/if-let/if-let.slang
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int test(IFoo foo, int idx)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
MyImpl impl = MyImpl();
MyImpl impl;
// CHECK: 0
// CHECK: 1
// CHECK: 2
Expand Down

0 comments on commit bd5742c

Please sign in to comment.