@@ -576,40 +576,37 @@ bool IGC::SOALayoutChecker::MismatchDetected(Instruction &I) {
576
576
if (!allocaIsVecOrArr)
577
577
return false ;
578
578
579
- bool useOldAlgorithm = ! useNewAlgo (pInfo-> baseType );
579
+ auto DL = I. getParent ()-> getParent ()-> getParent ()-> getDataLayout ( );
580
580
581
- if (useOldAlgorithm) {
582
- auto DL = I.getParent ()->getParent ()->getParent ()->getDataLayout ();
581
+ Type *pUserTy = I.getType ();
583
582
584
- Type *pUserTy = I.getType ();
583
+ if (auto *storeInst = dyn_cast<StoreInst>(&I))
584
+ pUserTy = storeInst->getValueOperand ()->getType ();
585
585
586
- if (auto *storeInst = dyn_cast<StoreInst>(&I))
587
- pUserTy = storeInst->getValueOperand ()->getType ();
588
-
589
- if (auto *pgep = dyn_cast<GetElementPtrInst>(parentLevelInst)) {
590
- allocaTy = pgep->getResultElementType ();
591
- } else {
592
- if (auto *arrTy = dyn_cast<ArrayType>(allocaTy)) {
593
- allocaTy = arrTy->getElementType ();
594
- } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(allocaTy)) {
595
- allocaTy = vec->getElementType ();
596
- }
586
+ if (auto *pgep = dyn_cast<GetElementPtrInst>(parentLevelInst)) {
587
+ allocaTy = pgep->getResultElementType ();
588
+ } else {
589
+ if (auto *arrTy = dyn_cast<ArrayType>(allocaTy)) {
590
+ allocaTy = arrTy->getElementType ();
591
+ } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(allocaTy)) {
592
+ allocaTy = vec->getElementType ();
593
+ }
597
594
598
- if (auto *arrTy = dyn_cast<ArrayType>(pUserTy)) {
599
- pUserTy = arrTy->getElementType ();
600
- } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(pUserTy)) {
601
- pUserTy = vec->getElementType ();
602
- }
595
+ if (auto *arrTy = dyn_cast<ArrayType>(pUserTy)) {
596
+ pUserTy = arrTy->getElementType ();
597
+ } else if (auto *vec = dyn_cast<IGCLLVM::FixedVectorType>(pUserTy)) {
598
+ pUserTy = vec->getElementType ();
603
599
}
600
+ }
604
601
605
- auto allocaSize = DL.getTypeAllocSize (allocaTy);
606
- auto vecTySize = DL.getTypeAllocSize (pUserTy);
602
+ auto allocaSize = DL.getTypeAllocSize (allocaTy);
603
+ auto vecTySize = DL.getTypeAllocSize (pUserTy);
607
604
608
- if (vecTySize != allocaSize) {
609
- pInfo->canUseSOALayout = false ;
610
- return true ;
611
- }
605
+ if (vecTySize != allocaSize) {
606
+ pInfo->canUseSOALayout = false ;
607
+ return true ;
612
608
}
609
+
613
610
return false ;
614
611
}
615
612
0 commit comments