File tree Expand file tree Collapse file tree 1 file changed +25
-8
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -527,14 +527,31 @@ class InstPartitionContainer {
527527 if (Ptr->hasOneUse () || Partition == -1 )
528528 continue ;
529529
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- }
530+ bool ProcessLoads = false ;
531+ for (auto *U : Ptr->users ()) {
532+ auto *CurLoad = dyn_cast<LoadInst>(U);
533+ if (!CurLoad)
534+ continue ;
535+ if (!L->contains (CurLoad->getParent ()))
536+ continue ;
537+
538+ ProcessLoads = true ;
539+ break ;
540+ }
541+
542+ if (!ProcessLoads)
543+ continue ;
544+
545+ const bool IsWritePtr = false ;
546+ auto ReadInstructions = LAI.getInstructionsForAccess (Ptr, IsWritePtr);
547+ for (Instruction *ReadInst : ReadInstructions) {
548+ if (Partition == (int )this ->InstToPartitionId [ReadInst])
549+ continue ;
550+
551+ // -1 means belonging to multiple partitions.
552+ Partition = -1 ;
553+ break ;
554+ }
538555 }
539556 }
540557
You can’t perform that action at this time.
0 commit comments