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