TranslatePreciseAttribute for libraries.

This commit is contained in:
Tex Riddell 2018-02-14 14:05:13 -08:00
Родитель 33e8b219fa
Коммит 824f7b0f8d
2 изменённых файлов: 19 добавлений и 12 удалений

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

@ -778,15 +778,22 @@ void DxilGenerationPass::TranslatePreciseAttribute() {
// argument and call site without precise argument, need to clone the function
// to propagate the precise for the precise call site.
// This should be done at CGMSHLSLRuntime::FinishCodeGen.
Function *EntryFn = m_pHLModule->GetEntryFunction();
if (!m_pHLModule->GetShaderModel()->IsLib()) {
if (m_pHLModule->GetShaderModel()->IsLib()) {
// TODO: If all functions have been inlined, and unreferenced functions removed,
// it should make sense to run on all funciton bodies,
// even when not processing a library.
for (Function &F : M.functions()) {
if (!F.isDeclaration())
TranslatePreciseAttributeOnFunction(F, M);
}
} else {
Function *EntryFn = m_pHLModule->GetEntryFunction();
TranslatePreciseAttributeOnFunction(*EntryFn, M);
}
if (m_pHLModule->GetShaderModel()->IsHS()) {
DxilFunctionProps &EntryQual = m_pHLModule->GetDxilFunctionProps(EntryFn);
Function *patchConstantFunc = EntryQual.ShaderProps.HS.patchConstantFunc;
TranslatePreciseAttributeOnFunction(*patchConstantFunc, M);
if (m_pHLModule->GetShaderModel()->IsHS()) {
DxilFunctionProps &EntryQual = m_pHLModule->GetDxilFunctionProps(EntryFn);
Function *patchConstantFunc = EntryQual.ShaderProps.HS.patchConstantFunc;
TranslatePreciseAttributeOnFunction(*patchConstantFunc, M);
}
}
}

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

@ -1,4 +1,4 @@
// RUN: %dxc -T lib_6_1 %s | FileCheck %s
// RUN: %dxc -T lib_6_3 %s | FileCheck %s
// Verify no hang on incomplete array
@ -32,7 +32,7 @@ float4 fn1(in Special in1: SEMANTIC_IN) : SEMANTIC_OUT {
// CHECK: getelementptr
// CHECK: load i32, i32*
// CHECK: sitofp i32
// CHECK: fadd float
// CHECK: fadd fast float
return in1.member + (float)s_testa[i];
}
@ -55,7 +55,7 @@ float4 fn3(in Special in1: SEMANTIC_IN) : SEMANTIC_OUT {
// CHECK: getelementptr
// CHECK: load i32, i32*
// CHECK: sitofp i32
// CHECK: fadd float
// CHECK: fadd fast float
return in1.member + (float)in1.a[i];
}
@ -72,6 +72,6 @@ float4 fn4(in Special in1: SEMANTIC_IN) : SEMANTIC_OUT {
// CHECK: extractvalue
// CHECK: , 0
// CHECK: sitofp i32
// CHECK: fadd float
// CHECK: fadd fast float
return in1.member + c_special.a[i];
}