Merged PR 59: Remove hl functions has body and always inline before DxilGeneration to avoid

Remove hl functions has body and always inline before DxilGeneration to avoid fail to find resource for update counter.
This commit is contained in:
Xiang_Li (XBox) 2018-03-27 21:35:10 +00:00
Родитель 6f531dedd0
Коммит 1d91a0a5b1
2 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -4001,10 +4001,14 @@ public:
m_HasDbgInfo = getDebugMetadataVersionFromModule(M) != 0;
std::deque<Function *> WorkList;
std::vector<Function *> DeadHLFunctions;
for (Function &F : M.functions()) {
HLOpcodeGroup group = GetHLOpcodeGroup(&F);
// Skip HL operations.
if (group != HLOpcodeGroup::NotHL || group == HLOpcodeGroup::HLExtIntrinsic) {
if (group != HLOpcodeGroup::NotHL ||
group == HLOpcodeGroup::HLExtIntrinsic) {
if (F.user_empty())
DeadHLFunctions.emplace_back(&F);
continue;
}
@ -4031,6 +4035,12 @@ public:
WorkList.emplace_back(&F);
}
// Remove dead hl functions here.
// This is for hl functions which has body and always inline.
for (Function *F : DeadHLFunctions) {
F->eraseFromParent();
}
// Preprocess aggregate function param used as function call arg.
for (Function *F : WorkList) {
preprocessArgUsedInCall(F);

Просмотреть файл

@ -0,0 +1,18 @@
// RUN: %dxc -T lib_6_2 %s | FileCheck %s
// Make sure append/consume works for lib.
// CHECK: bufferUpdateCounter(i32 70, {{.*}}, i8 -1)
// CHECK: bufferUpdateCounter(i32 70, {{.*}}, i8 1)
// Append Structured Buffer (u3)
AppendStructuredBuffer<float4> appendUAVResource : register(u3);
// Consume Structured Buffer (u4)
ConsumeStructuredBuffer<float4> consumeUAVResource : register(u4);
[shader("compute")]
void test()
{
float4 consumeResourceOutput = consumeUAVResource.Consume();
appendUAVResource.Append(consumeResourceOutput);
}