@@ -114,8 +114,6 @@ STATISTIC(Stat_DiscardRemoved, "Number of insts removed in Discard Opt");
114
114
115
115
bool CustomSafeOptPass::runOnFunction (Function& F)
116
116
{
117
- pContext = getAnalysis<CodeGenContextWrapper>().getCodeGenContext ();
118
- m_modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData ();
119
117
psHasSideEffect = getAnalysis<CodeGenContextWrapper>().getCodeGenContext ()->m_instrTypes .psHasSideEffect ;
120
118
visit (F);
121
119
return true ;
@@ -729,58 +727,12 @@ void CustomSafeOptPass::visitCallInst(CallInst& C)
729
727
visitLdRawVec (inst);
730
728
break ;
731
729
}
732
- case GenISAIntrinsic::GenISA_OUTPUT:
733
- {
734
- earlyZDepthDetection (C);
735
- break ;
736
- }
737
730
default :
738
731
break ;
739
732
}
740
733
}
741
734
}
742
735
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
-
784
736
//
785
737
// pattern match packing of two half float from f32tof16:
786
738
//
0 commit comments