Skip to content

Commit 6c471b3

Browse files
esukhovigcbot
authored andcommitted
Vectorizer quality of life update
Add flags and make more uniform type building in vectorizer.
1 parent 3207183 commit 6c471b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

IGC/Compiler/CISACodeGen/IGCVectorizer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ bool isSafeToVectorize(Instruction *I) {
213213
llvm::isa<PHINode>(I) ||
214214
llvm::isa<ExtractElementInst>(I) ||
215215
llvm::isa<InsertElementInst>(I) ||
216-
llvm::isa<FPTruncInst>(I) ||
216+
( llvm::isa<FPTruncInst>(I) && IGC_GET_FLAG_VALUE(VectorizerAllowFPTRUNC) ) ||
217217
isBinarySafe(I);
218218

219219
return Result;
@@ -230,7 +230,9 @@ bool IGCVectorizer::handlePHI(VecArr &Slice, Type *VectorType) {
230230
return true;
231231
}
232232

233-
PHINode *Phi = PHINode::Create(VectorType, 2);
233+
llvm::VectorType* PhiVectorType = llvm::FixedVectorType::get(ScalarPhi->getType(), Slice.size());
234+
235+
PHINode *Phi = PHINode::Create(PhiVectorType, 2);
234236
Phi->setName("vectorized_phi");
235237

236238
VecVal Operands;

IGC/common/igc_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ DECLARE_IGC_REGKEY(bool, EnableVectorizer, true, "Enable IGCVectori
509509
DECLARE_IGC_REGKEY(bool, VectorizerCheckScalarizer, false, "Add scalariser after vectorizer to check performance", true)
510510
DECLARE_IGC_REGKEY(DWORD, VectorizerList, -1, "Vectorize only one seed instruction with the provided number", true)
511511
DECLARE_IGC_REGKEY(bool, EnableVectorEmitter, true, "Enable Vector Emission for a vectorizer", true)
512+
DECLARE_IGC_REGKEY(bool, VectorizerAllowFPTRUNC, true, "Allow FPTRUNC instructions inside vectorizer", true)
512513
DECLARE_IGC_REGKEY(bool, VectorizerAllowFDIV, true, "Allow FDIV instructions inside vectorizer", true)
513514
DECLARE_IGC_REGKEY(bool, VectorizerAllowFADD, true, "Allow FADD instructions inside vectorizer", true)
514515
DECLARE_IGC_REGKEY(bool, DisableOCLScalarizer, false, "Disable ScalarizeFunction pass in OCL pipeline", true)

0 commit comments

Comments
 (0)