@@ -114,8 +114,6 @@ STATISTIC(Stat_DiscardRemoved, "Number of insts removed in Discard Opt");
114114
115115bool 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//
0 commit comments