@@ -2573,8 +2573,6 @@ namespace {
25732573 bool getAddressDiffIfConstant (Instruction* I0, Instruction* I1, int64_t & ConstBO);
25742574
25752575 // Create unique identified struct type
2576- SmallVector<StructType*, 16 > m_allLayoutStructTypes;
2577- void initLayoutStructType (Module* M);
25782576 StructType* getOrCreateUniqueIdentifiedStructType (
25792577 ArrayRef<Type*> EltTys, bool IsSOA, bool IsPacked = true );
25802578
@@ -2588,7 +2586,6 @@ namespace {
25882586 m_visited.clear ();
25892587 m_instOrder.clear ();
25902588 m_bundles.clear ();
2591- m_allLayoutStructTypes.clear ();
25922589 }
25932590 };
25942591}
@@ -2773,8 +2770,6 @@ bool LdStCombine::runOnFunction(Function& F)
27732770 }
27742771 m_F = &F;
27752772
2776- initLayoutStructType (m_F->getParent ());
2777-
27782773 // Initialize symbolic evaluation
27792774 m_symEval.setDataLayout (m_DL);
27802775
@@ -3397,23 +3392,6 @@ void LdStCombine::mergeConstElements(
33973392 EltVals.insert (EltVals.end (), mergedElts.begin (), mergedElts.end ());
33983393}
33993394
3400- // Get all layout struct types created already for different functions in
3401- // the same module.
3402- //
3403- // This is for creating unique struct layout type per module. Layout
3404- // struct type is identified, but if two identified layout structs are
3405- // the same layout, they are the same.
3406- void LdStCombine::initLayoutStructType (Module* M)
3407- {
3408- auto modAllNamedStructTys = M->getIdentifiedStructTypes ();
3409- for (auto II : modAllNamedStructTys) {
3410- StructType* stTy = II;
3411- if (isLayoutStructType (stTy)) {
3412- m_allLayoutStructTypes.push_back (stTy);
3413- }
3414- }
3415- }
3416-
34173395// This is to make sure to reuse the layout types. Two identified structs have
34183396// the same layout if
34193397// 1. both are SOA or both are AOS; and
@@ -3422,7 +3400,8 @@ void LdStCombine::initLayoutStructType(Module* M)
34223400StructType* LdStCombine::getOrCreateUniqueIdentifiedStructType (
34233401 ArrayRef<Type*> EltTys, bool IsSOA, bool IsPacked)
34243402{
3425- for (auto II : m_allLayoutStructTypes) {
3403+ auto & layoutStructTypes = m_CGC->getLayoutStructTypes ();
3404+ for (auto II : layoutStructTypes) {
34263405 StructType* stTy = II;
34273406 if (IsPacked == stTy->isPacked () &&
34283407 IsSOA == isLayoutStructTypeSOA (stTy) &&
@@ -3434,7 +3413,7 @@ StructType* LdStCombine::getOrCreateUniqueIdentifiedStructType(
34343413 StructType* StTy = StructType::create (EltTys,
34353414 IsSOA ? getStructNameForSOALayout () : getStructNameForAOSLayout (),
34363415 IsPacked);
3437- m_allLayoutStructTypes .push_back (StTy);
3416+ layoutStructTypes .push_back (StTy);
34383417 return StTy;
34393418}
34403419
0 commit comments