@@ -2426,9 +2426,9 @@ bool LoopAccessInfo::canAnalyzeLoop() {
2426
2426
return true ;
2427
2427
}
2428
2428
2429
- bool LoopAccessInfo::analyzeLoop (AAResults *AA, LoopInfo *LI,
2430
- const TargetLibraryInfo *TLI ,
2431
- DominatorTree *DT) {
2429
+ LoopAccessInfo::VecMemPossible
2430
+ LoopAccessInfo::analyzeLoop (AAResults *AA, LoopInfo *LI ,
2431
+ const TargetLibraryInfo *TLI, DominatorTree *DT) {
2432
2432
// Holds the Load and Store instructions.
2433
2433
SmallVector<LoadInst *, 16 > Loads;
2434
2434
SmallVector<StoreInst *, 16 > Stores;
@@ -2468,7 +2468,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2468
2468
// With both a non-vectorizable memory instruction and a convergent
2469
2469
// operation, found in this loop, no reason to continue the search.
2470
2470
if (HasComplexMemInst && HasConvergentOp)
2471
- return false ;
2471
+ return CantVec ;
2472
2472
2473
2473
// Avoid hitting recordAnalysis multiple times.
2474
2474
if (HasComplexMemInst)
@@ -2544,7 +2544,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2544
2544
} // Next block.
2545
2545
2546
2546
if (HasComplexMemInst)
2547
- return false ;
2547
+ return CantVec ;
2548
2548
2549
2549
// Now we have two lists that hold the loads and the stores.
2550
2550
// Next, we find the pointers that they use.
@@ -2553,7 +2553,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2553
2553
// care if the pointers are *restrict*.
2554
2554
if (!Stores.size ()) {
2555
2555
LLVM_DEBUG (dbgs () << " LAA: Found a read-only loop!\n " );
2556
- return true ;
2556
+ return NormalVec ;
2557
2557
}
2558
2558
2559
2559
MemoryDepChecker::DepCandidates DependentAccesses;
@@ -2606,7 +2606,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2606
2606
LLVM_DEBUG (
2607
2607
dbgs () << " LAA: A loop annotated parallel, ignore memory dependency "
2608
2608
<< " checks.\n " );
2609
- return true ;
2609
+ return NormalVec ;
2610
2610
}
2611
2611
2612
2612
for (LoadInst *LD : Loads) {
@@ -2653,7 +2653,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2653
2653
// other reads in this loop then is it safe to vectorize.
2654
2654
if (NumReadWrites == 1 && NumReads == 0 ) {
2655
2655
LLVM_DEBUG (dbgs () << " LAA: Found a write-only loop!\n " );
2656
- return true ;
2656
+ return NormalVec ;
2657
2657
}
2658
2658
2659
2659
// Build dependence sets and check whether we need a runtime pointer bounds
@@ -2675,7 +2675,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2675
2675
<< " cannot identify array bounds" ;
2676
2676
LLVM_DEBUG (dbgs () << " LAA: We can't vectorize because we can't find "
2677
2677
<< " the array bounds.\n " );
2678
- return false ;
2678
+ return CantVec ;
2679
2679
}
2680
2680
2681
2681
LLVM_DEBUG (
@@ -2708,7 +2708,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2708
2708
recordAnalysis (" CantCheckMemDepsAtRunTime" , I)
2709
2709
<< " cannot check memory dependencies at runtime" ;
2710
2710
LLVM_DEBUG (dbgs () << " LAA: Can't vectorize with memory checks\n " );
2711
- return false ;
2711
+ return CantVec ;
2712
2712
}
2713
2713
DepsAreSafe = true ;
2714
2714
}
@@ -2719,19 +2719,19 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
2719
2719
<< " cannot add control dependency to convergent operation" ;
2720
2720
LLVM_DEBUG (dbgs () << " LAA: We can't vectorize because a runtime check "
2721
2721
" would be needed with a convergent operation\n " );
2722
- return false ;
2722
+ return CantVec ;
2723
2723
}
2724
2724
2725
2725
if (DepsAreSafe) {
2726
2726
LLVM_DEBUG (
2727
2727
dbgs () << " LAA: No unsafe dependent memory operations in loop. We"
2728
2728
<< (PtrRtChecking->Need ? " " : " don't" )
2729
2729
<< " need runtime memory checks.\n " );
2730
- return true ;
2730
+ return Histograms. empty () ? NormalVec : HistogramVec ;
2731
2731
}
2732
2732
2733
2733
emitUnsafeDependenceRemark ();
2734
- return false ;
2734
+ return CantVec ;
2735
2735
}
2736
2736
2737
2737
void LoopAccessInfo::emitUnsafeDependenceRemark () {
@@ -3065,7 +3065,7 @@ LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
3065
3065
}
3066
3066
3067
3067
void LoopAccessInfo::print (raw_ostream &OS, unsigned Depth) const {
3068
- if (CanVecMem) {
3068
+ if (CanVecMem != CantVec ) {
3069
3069
OS.indent (Depth) << " Memory dependences are safe" ;
3070
3070
const MemoryDepChecker &DC = getDepChecker ();
3071
3071
if (!DC.isSafeForAnyVectorWidth ())
0 commit comments