Skip to content

Commit ffcf9fb

Browse files
dlei6gigcbot
authored andcommitted
Add support for FNeg instruction uniform analysis
Add support for FNeg instruction uniform analysis
1 parent 590c1ba commit ffcf9fb

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

IGC/Compiler/CISACodeGen/WIAnalysis.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -809,23 +809,26 @@ void WIAnalysisRunner::calculate_dep(const Value* val)
809809
// LLVM does not have compile time polymorphisms
810810
// TODO: to make things faster we may want to sort the list below according
811811
// to the order of their probability of appearance.
812-
if (const BinaryOperator * BI = dyn_cast<BinaryOperator>(inst)) dep = calculate_dep(BI);
813-
else if (const CallInst * CI = dyn_cast<CallInst>(inst)) dep = calculate_dep(CI);
812+
if (const BinaryOperator* BI = dyn_cast<BinaryOperator>(inst)) dep = calculate_dep(BI);
813+
else if (const CallInst* CI = dyn_cast<CallInst>(inst)) dep = calculate_dep(CI);
814814
else if (isa<CmpInst>(inst)) dep = calculate_dep_simple(inst);
815815
else if (isa<ExtractElementInst>(inst)) dep = calculate_dep_simple(inst);
816-
else if (const GetElementPtrInst * GEP = dyn_cast<GetElementPtrInst>(inst)) dep = calculate_dep(GEP);
816+
else if (const GetElementPtrInst* GEP = dyn_cast<GetElementPtrInst>(inst)) dep = calculate_dep(GEP);
817817
else if (isa<InsertElementInst>(inst)) dep = calculate_dep_simple(inst);
818818
else if (isa<InsertValueInst>(inst)) dep = calculate_dep_simple(inst);
819-
else if (const PHINode * Phi = dyn_cast<PHINode>(inst)) dep = calculate_dep(Phi);
819+
else if (const PHINode* Phi = dyn_cast<PHINode>(inst)) dep = calculate_dep(Phi);
820820
else if (isa<ShuffleVectorInst>(inst)) dep = calculate_dep_simple(inst);
821821
else if (isa<StoreInst>(inst)) dep = calculate_dep_simple(inst);
822822
else if (inst->isTerminator()) dep = calculate_dep_terminator(dyn_cast<IGCLLVM::TerminatorInst>(inst));
823-
else if (const SelectInst * SI = dyn_cast<SelectInst>(inst)) dep = calculate_dep(SI);
824-
else if (const AllocaInst * AI = dyn_cast<AllocaInst>(inst)) dep = calculate_dep(AI);
825-
else if (const CastInst * CI = dyn_cast<CastInst>(inst)) dep = calculate_dep(CI);
823+
else if (const SelectInst* SI = dyn_cast<SelectInst>(inst)) dep = calculate_dep(SI);
824+
else if (const AllocaInst* AI = dyn_cast<AllocaInst>(inst)) dep = calculate_dep(AI);
825+
else if (const CastInst* CI = dyn_cast<CastInst>(inst)) dep = calculate_dep(CI);
826826
else if (isa<ExtractValueInst>(inst)) dep = calculate_dep_simple(inst);
827-
else if (const LoadInst * LI = dyn_cast<LoadInst>(inst)) dep = calculate_dep(LI);
828-
else if (const VAArgInst * VAI = dyn_cast<VAArgInst>(inst)) dep = calculate_dep(VAI);
827+
else if (const LoadInst* LI = dyn_cast<LoadInst>(inst)) dep = calculate_dep(LI);
828+
else if (const VAArgInst* VAI = dyn_cast<VAArgInst>(inst)) dep = calculate_dep(VAI);
829+
#if LLVM_VERSION_MAJOR >= 10
830+
else if (inst->getOpcode() == Instruction::FNeg) dep = calculate_dep_simple(inst);
831+
#endif
829832

830833
if (m_func->hasFnAttribute("KMPLOCK"))
831834
{

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
29832983
}
29842984
else
29852985
{
2986-
uint32_t vectorSize = cast<VectorType>(I.getType())->getNumElements();
2986+
uint32_t vectorSize = (uint32_t)cast<VectorType>(I.getType())->getNumElements();
29872987
fsub = llvm::UndefValue::get(I.getType());
29882988

29892989
for (uint32_t i = 0; i < vectorSize; ++i)

0 commit comments

Comments
 (0)