Skip to content

Commit 98af9b9

Browse files
mkhoshzaigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: efc6f8e
Adding earlyZ test Adding earlyZ test
1 parent 1f22866 commit 98af9b9

File tree

2 files changed

+1
-52
lines changed

2 files changed

+1
-52
lines changed

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ STATISTIC(Stat_DiscardRemoved, "Number of insts removed in Discard Opt");
114114

115115
bool CustomSafeOptPass::runOnFunction(Function& F)
116116
{
117-
pContext = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
118-
m_modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
119117
psHasSideEffect = getAnalysis<CodeGenContextWrapper>().getCodeGenContext()->m_instrTypes.psHasSideEffect;
120118
visit(F);
121119
return true;
@@ -729,58 +727,12 @@ void CustomSafeOptPass::visitCallInst(CallInst& C)
729727
visitLdRawVec(inst);
730728
break;
731729
}
732-
case GenISAIntrinsic::GenISA_OUTPUT:
733-
{
734-
earlyZDepthDetection(C);
735-
break;
736-
}
737730
default:
738731
break;
739732
}
740733
}
741734
}
742735

743-
void IGC::CustomSafeOptPass::earlyZDepthDetection(llvm::CallInst& C)
744-
{
745-
if (pContext->type == ShaderType::PIXEL_SHADER)
746-
{
747-
uint outputType = (uint)cast<ConstantInt>((&C)->getOperand(4))->getZExtValue();
748-
if (outputType == SHADER_OUTPUT_TYPE_DEPTHOUT)
749-
{
750-
uint depthMask = (uint)cast<ConstantInt>((&C)->getOperand(5))->getZExtValue();
751-
if (depthMask == 0)
752-
{
753-
if (CallInst* minInst = dyn_cast<CallInst>((&C)->getOperand(0)))
754-
{
755-
if (GetOpCode(minInst) == llvm_min || GetOpCode(minInst) == llvm_max)
756-
{
757-
if (Instruction* divInst = dyn_cast<Instruction>(minInst->getOperand(0)))
758-
{
759-
if (divInst->getOpcode() == Instruction::FDiv)
760-
{
761-
if (Instruction* mulInst = dyn_cast<Instruction>(divInst->getOperand(0)))
762-
{
763-
if (mulInst->getOpcode() == Instruction::FMul)
764-
{
765-
if (mulInst->getOperand(1) == divInst->getOperand(1))
766-
{
767-
(&C)->eraseFromParent();
768-
IGC::PixelShaderContext* psContext = static_cast<IGC::PixelShaderContext*>(pContext);
769-
psContext->programOutput.outputDepth = false;
770-
m_modMD->psInfo.outputDepth = false;
771-
return;
772-
}
773-
}
774-
}
775-
}
776-
}
777-
}
778-
}
779-
}
780-
}
781-
}
782-
}
783-
784736
//
785737
// pattern match packing of two half float from f32tof16:
786738
//

IGC/Compiler/CustomSafeOptPass.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ namespace IGC
4141
virtual void getAnalysisUsage(llvm::AnalysisUsage& AU) const override
4242
{
4343
AU.addRequired<CodeGenContextWrapper>();
44-
AU.addRequired<MetaDataUtilsWrapper>();
4544
AU.setPreservesCFG();
4645
}
4746

@@ -56,7 +55,6 @@ namespace IGC
5655
void visitUDiv(llvm::BinaryOperator& I);
5756
void visitAllocaInst(llvm::AllocaInst& I);
5857
void visitCallInst(llvm::CallInst& C);
59-
void earlyZDepthDetection(llvm::CallInst& C);
6058
void removeHftoFCast(llvm::Instruction& I);
6159
void visitBinaryOperator(llvm::BinaryOperator& I);
6260
bool isEmulatedAdd(llvm::BinaryOperator& I);
@@ -99,8 +97,7 @@ namespace IGC
9997
template <typename MaskType> void matchReverse(llvm::BinaryOperator& I);
10098
private:
10199
bool psHasSideEffect;
102-
CodeGenContext* pContext = nullptr;
103-
IGC::ModuleMetaData* m_modMD = nullptr;
100+
104101
bool lower64bto32b(llvm::BinaryOperator& AndInst);
105102
llvm::Value* analyzeTreeForTrunc64bto32b(const llvm::Use& OperandUse, llvm::SmallVector<llvm::BinaryOperator*, 8>& OpsToDelete);
106103
};

0 commit comments

Comments
 (0)