@@ -3601,14 +3601,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3601
3601
return std::make_unique<Dependence>(Src, Dst);
3602
3602
}
3603
3603
3604
- assert (isLoadOrStore (Src) && " instruction is not load or store" );
3605
- assert (isLoadOrStore (Dst) && " instruction is not load or store" );
3606
- Value *SrcPtr = getLoadStorePointerOperand (Src);
3607
- Value *DstPtr = getLoadStorePointerOperand (Dst);
3604
+ const MemoryLocation &LocA = MemoryLocation::get (Dst);
3605
+ const MemoryLocation &LocB = MemoryLocation::get (Src);
3608
3606
3609
- switch (underlyingObjectsAlias (AA, F->getDataLayout (),
3610
- MemoryLocation::get (Dst),
3611
- MemoryLocation::get (Src))) {
3607
+ switch (underlyingObjectsAlias (AA, F->getDataLayout (), LocA, LocB)) {
3612
3608
case AliasResult::MayAlias:
3613
3609
case AliasResult::PartialAlias:
3614
3610
// cannot analyse objects if we don't understand their aliasing.
@@ -3622,6 +3618,13 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3622
3618
break ; // The underlying objects alias; test accesses for dependence.
3623
3619
}
3624
3620
3621
+ if (LocA.Size != LocB.Size ) {
3622
+ // The dependence test gets confused if the size of the memory accesses
3623
+ // differ.
3624
+ LLVM_DEBUG (dbgs () << " can't analyze must alias with different sizes\n " );
3625
+ return std::make_unique<Dependence>(Src, Dst);
3626
+ }
3627
+
3625
3628
// establish loop nesting levels
3626
3629
establishNestingLevels (Src, Dst);
3627
3630
LLVM_DEBUG (dbgs () << " common nesting levels = " << CommonLevels << " \n " );
@@ -3632,6 +3635,8 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3632
3635
3633
3636
unsigned Pairs = 1 ;
3634
3637
SmallVector<Subscript, 2 > Pair (Pairs);
3638
+ Value *SrcPtr = getLoadStorePointerOperand (Src);
3639
+ Value *DstPtr = getLoadStorePointerOperand (Dst);
3635
3640
const SCEV *SrcSCEV = SE->getSCEV (SrcPtr);
3636
3641
const SCEV *DstSCEV = SE->getSCEV (DstPtr);
3637
3642
LLVM_DEBUG (dbgs () << " SrcSCEV = " << *SrcSCEV << " \n " );
0 commit comments