@@ -3602,14 +3602,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3602
3602
return std::make_unique<Dependence>(Src, Dst);
3603
3603
}
3604
3604
3605
- assert (isLoadOrStore (Src) && " instruction is not load or store" );
3606
- assert (isLoadOrStore (Dst) && " instruction is not load or store" );
3607
- Value *SrcPtr = getLoadStorePointerOperand (Src);
3608
- Value *DstPtr = getLoadStorePointerOperand (Dst);
3605
+ const MemoryLocation &DstLoc = MemoryLocation::get (Dst);
3606
+ const MemoryLocation &SrcLoc = MemoryLocation::get (Src);
3609
3607
3610
- switch (underlyingObjectsAlias (AA, F->getDataLayout (),
3611
- MemoryLocation::get (Dst),
3612
- MemoryLocation::get (Src))) {
3608
+ switch (underlyingObjectsAlias (AA, F->getDataLayout (), DstLoc, SrcLoc)) {
3613
3609
case AliasResult::MayAlias:
3614
3610
case AliasResult::PartialAlias:
3615
3611
// cannot analyse objects if we don't understand their aliasing.
@@ -3623,16 +3619,15 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3623
3619
break ; // The underlying objects alias; test accesses for dependence.
3624
3620
}
3625
3621
3626
- // establish loop nesting levels
3627
- establishNestingLevels (Src, Dst);
3628
- LLVM_DEBUG (dbgs () << " common nesting levels = " << CommonLevels << " \n " );
3629
- LLVM_DEBUG (dbgs () << " maximum nesting levels = " << MaxLevels << " \n " );
3630
-
3631
- FullDependence Result (Src, Dst, PossiblyLoopIndependent, CommonLevels);
3632
- ++TotalArrayPairs;
3622
+ if (DstLoc.Size != SrcLoc.Size ) {
3623
+ // The dependence test gets confused if the size of the memory accesses
3624
+ // differ.
3625
+ LLVM_DEBUG (dbgs () << " can't analyze must alias with different sizes\n " );
3626
+ return std::make_unique<Dependence>(Src, Dst);
3627
+ }
3633
3628
3634
- unsigned Pairs = 1 ;
3635
- SmallVector<Subscript, 2 > Pair (Pairs );
3629
+ Value *SrcPtr = getLoadStorePointerOperand (Src) ;
3630
+ Value *DstPtr = getLoadStorePointerOperand (Dst );
3636
3631
const SCEV *SrcSCEV = SE->getSCEV (SrcPtr);
3637
3632
const SCEV *DstSCEV = SE->getSCEV (DstPtr);
3638
3633
LLVM_DEBUG (dbgs () << " SrcSCEV = " << *SrcSCEV << " \n " );
@@ -3647,6 +3642,17 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3647
3642
LLVM_DEBUG (dbgs () << " can't analyze SCEV with different pointer base\n " );
3648
3643
return std::make_unique<Dependence>(Src, Dst);
3649
3644
}
3645
+
3646
+ // establish loop nesting levels
3647
+ establishNestingLevels (Src, Dst);
3648
+ LLVM_DEBUG (dbgs () << " common nesting levels = " << CommonLevels << " \n " );
3649
+ LLVM_DEBUG (dbgs () << " maximum nesting levels = " << MaxLevels << " \n " );
3650
+
3651
+ FullDependence Result (Src, Dst, PossiblyLoopIndependent, CommonLevels);
3652
+ ++TotalArrayPairs;
3653
+
3654
+ unsigned Pairs = 1 ;
3655
+ SmallVector<Subscript, 2 > Pair (Pairs);
3650
3656
Pair[0 ].Src = SrcSCEV;
3651
3657
Pair[0 ].Dst = DstSCEV;
3652
3658
0 commit comments