@@ -504,6 +504,12 @@ class InstPartitionContainer {
504504 Value *Ptr = RtPtrCheck->Pointers [I].PointerValue ;
505505 auto Instructions =
506506 LAI.getInstructionsForAccess (Ptr, RtPtrCheck->Pointers [I].IsWritePtr );
507+ const MemoryDepChecker &DC = LAI.getDepChecker ();
508+ bool IsWritePtr = !RtPtrCheck->Pointers [I].IsWritePtr ;
509+ if (!DC.getOrderForAccess (Ptr, IsWritePtr).empty ()) {
510+ auto AltInstructions = LAI.getInstructionsForAccess (Ptr, IsWritePtr);
511+ Instructions.append (AltInstructions.begin (), AltInstructions.end ());
512+ }
507513
508514 int &Partition = PtrToPartitions[I];
509515 // First set it to uninitialized.
@@ -521,21 +527,6 @@ class InstPartitionContainer {
521527 Partition = -1 ;
522528 }
523529 assert (Partition != -2 && " Pointer not belonging to any partition" );
524- // All the store context uses of our address were processed,
525- // Now make sure we don't have cross partition loads.
526- if (RtPtrCheck->Pointers [I].IsWritePtr ) {
527- if (Ptr->hasOneUse () || Partition == -1 )
528- continue ;
529-
530- for (User *U : Ptr->users ())
531- if (auto *CurLoad = dyn_cast<LoadInst>(U))
532- if (L->contains (CurLoad->getParent ()))
533- if (Partition != (int )this ->InstToPartitionId [CurLoad]) {
534- // -1 means belonging to multiple partitions.
535- Partition = -1 ;
536- break ;
537- }
538- }
539530 }
540531
541532 return PtrToPartitions;
0 commit comments