@@ -3311,17 +3311,11 @@ bool GenXPatternMatch::distributeIntegerMul(Function *F) {
33113311// where ShtAmt[0] is a constant vector and ShtAmt[i] are constant splats.
33123312static bool analyzeForShiftPattern (Constant *C,
33133313 SmallVectorImpl<Constant *> &ShtAmt,
3314- const DataLayout &DL,
3315- const llvm::GenXSubtarget &Subtarget) {
3314+ const DataLayout &DL) {
3315+ unsigned Width = 8 ;
33163316 auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType ());
3317- if (!VT || VT->getScalarSizeInBits () == 1 )
3317+ if (!VT || VT->getNumElements () <= Width || VT-> getScalarSizeInBits () == 1 )
33183318 return false ;
3319-
3320- unsigned ElmSz = VT->getScalarSizeInBits () / genx::ByteBits;
3321- unsigned Width = Subtarget.getGRFByteSize () / ElmSz;
3322- if (cast<IGCLLVM::FixedVectorType>(VT)->getNumElements () <= Width)
3323- return false ;
3324-
33253319 unsigned NElts = VT->getNumElements ();
33263320 if (NElts % Width != 0 )
33273321 return false ;
@@ -3394,9 +3388,6 @@ static bool analyzeForShiftPattern(Constant *C,
33943388}
33953389
33963390bool GenXPatternMatch::vectorizeConstants (Function *F) {
3397- const GenXSubtarget *ST = &getAnalysis<TargetPassConfig>()
3398- .getTM <GenXTargetMachine>()
3399- .getGenXSubtarget ();
34003391 bool Changed = false ;
34013392 for (auto &BB : F->getBasicBlockList ()) {
34023393 for (auto I = BB.begin (); I != BB.end ();) {
@@ -3419,7 +3410,7 @@ bool GenXPatternMatch::vectorizeConstants(Function *F) {
34193410 C->getSplatValue ())
34203411 continue ;
34213412 SmallVector<Constant *, 8 > ShtAmt;
3422- if (analyzeForShiftPattern (C, ShtAmt, *DL, *ST )) {
3413+ if (analyzeForShiftPattern (C, ShtAmt, *DL)) {
34233414 // W1 = wrrregion(undef, ShtAmt[0], 0);
34243415 // V2 = fadd ShtAmt[0], ShtAmt[1]
34253416 // W2 = wrregion(W1, V2, Width)
0 commit comments