LLVM: include/llvm/Analysis/LoopAccessAnalysis.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_ANALYSIS_LOOPACCESSANALYSIS_H

15#define LLVM_ANALYSIS_LOOPACCESSANALYSIS_H

16

21#include

22#include

23

24namespace llvm {

25

31

32

33

35

37

38

40

42

44

45

46

48

49

50

51

52

53

55};

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

92public:

95

97

98

99

100

110

111

113

115

117

119

120

121

122

124

125

126

127

128

129

130

131

132

133

135

136

138

140

141

143

145 };

146

147

149

150

152

154

156

159

160

162

164

165

168

169

171

173

174

176

177

178

181 };

182

186 unsigned MaxTargetVectorWidthInBits,

187 std::optionalScalarEvolution::LoopGuards &LoopGuards)

188 : PSE(PSE), AC(AC), DT(DT), InnermostLoop(L),

189 SymbolicStrides(SymbolicStrides),

190 MaxTargetVectorWidthInBits(MaxTargetVectorWidthInBits),

191 LoopGuards(LoopGuards) {}

192

193

194

196

197

198

200

201

202

203

204

207

208

209

213

214

215

217 return MaxSafeVectorWidthInBits == UINT_MAX;

218 }

219

220

221

223 return MaxSafeVectorWidthInBits;

224 }

225

226

228 return MaxStoreLoadForwardSafeDistanceInBits ==

229 std::numeric_limits<uint64_t>::max();

230 }

231

232

233

236 "Expected the distance, that prevent store-load forwarding, to be "

237 "set.");

238 return MaxStoreLoadForwardSafeDistanceInBits;

239 }

240

241

242

244 return ShouldRetryWithRuntimeChecks &&

246 }

247

248

249

250

252 return RecordDependences ? &Dependences : nullptr;

253 }

254

256

257

258

260 return InstMap;

261 }

262

263

264

267

268 for (unsigned I = 0; I < InstMap.size(); ++I)

269 OrderMap[InstMap[I]] = I;

270

271 return OrderMap;

272 }

273

274

277

278

279

281 auto I = Accesses.find({Ptr, IsWrite});

282 if (I != Accesses.end())

283 return I->second;

284 return {};

285 }

286

288

290 std::pair<const SCEV *, const SCEV *>> &

292 return PointerBounds;

293 }

294

296 assert(DT && "requested DT, but it is not available");

297 return DT;

298 }

300 assert(AC && "requested AC, but it is not available");

301 return AC;

302 }

303

304private:

305

306

307

308

309

310

312

315

316 const Loop *InnermostLoop;

317

318

319

321

322

324

325

327

328

329 unsigned AccessIdx = 0;

330

331

332

333

334 uint64_t MinDepDistBytes = 0;

335

336

337

338

339

340 uint64_t MaxSafeVectorWidthInBits = -1U;

341

342

343

344 uint64_t MaxStoreLoadForwardSafeDistanceInBits =

345 std::numeric_limits<uint64_t>::max();

346

347

348

349 bool ShouldRetryWithRuntimeChecks = false;

350

351

352

353

355

356

357

358

359 bool RecordDependences = true;

360

361

362

364

365

366

367

368

369 unsigned MaxTargetVectorWidthInBits = 0;

370

371

372

374 std::pair<const SCEV *, const SCEV *>>

376

377

378 std::optionalScalarEvolution::LoopGuards &LoopGuards;

379

380

381

382

383

384

385

386

387

388

389

390

391

394

395

396

397

398

399

400 bool couldPreventStoreLoadForward(uint64_t Distance, uint64_t TypeByteSize,

401 unsigned CommonStride = 0);

402

403

404

405

406 void mergeInStatus(VectorizationSafetyStatus S);

407

408 struct DepDistanceStrideAndSizeInfo {

409 const SCEV *Dist;

410

411

412

414 std::optional<uint64_t> CommonStride;

415

416

417

419

420 bool AIsWrite;

421 bool BIsWrite;

422

423 DepDistanceStrideAndSizeInfo(const SCEV *Dist, uint64_t MaxStride,

424 std::optional<uint64_t> CommonStride,

425 uint64_t TypeByteSize, bool AIsWrite,

426 bool BIsWrite)

427 : Dist(Dist), MaxStride(MaxStride), CommonStride(CommonStride),

428 TypeByteSize(TypeByteSize), AIsWrite(AIsWrite), BIsWrite(BIsWrite) {}

429 };

430

431

432

433

434

435

436

437

438

439 std::variant<Dependence::DepType, DepDistanceStrideAndSizeInfo>

440 getDependenceDistanceStrideAndSize(const MemAccessInfo &A, Instruction *AInst,

442 Instruction *BInst);

443

444

445

446 bool areAccessesCompletelyBeforeOrAfter(const SCEV *Src, Type *SrcTy,

447 const SCEV *Sink, Type *SinkTy);

448};

449

451

452

454

455

458

459

460

461

462

463

468

469

470

472

473

475

477

479

480

482};

483

484

488

500

501

502

505

506public:

508

510

511

513

514

516

518

519

521

523

525

527

534 };

535

537 std::optionalScalarEvolution::LoopGuards &LoopGuards)

538 : DC(DC), SE(SE), LoopGuards(LoopGuards) {}

539

540

542 Need = false;

543 CanUseDiffCheck = true;

545 Checks.clear();

546 DiffChecks.clear();

548 }

549

550

551

552

553

554

556 Type *AccessTy, bool WritePtr, unsigned DepSetId,

558 bool NeedsFreeze);

559

560

562

563

564

566 bool UseDependencies);

567

568

569

573

574

575

576

577

578

579 std::optional<ArrayRef> getDiffChecks() const {

580 if (!CanUseDiffCheck)

581 return std::nullopt;

582 return {DiffChecks};

583 }

584

585

586

589

590

591

593

594

596

597

600 unsigned Depth = 0) const;

601

602

604

605

607

608

610

611

612

613

614

617 unsigned PtrIdx1, unsigned PtrIdx2);

618

619

620

622

623

627

629

630private:

631

632

633

634

636 bool UseDependencies);

637

638

640

641

642

643

646

648

649

651

652

653 std::optionalScalarEvolution::LoopGuards &LoopGuards;

654

655

656

658

659

660 bool CanUseDiffCheck = true;

661

662

663

665};

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

690public:

695 bool AllowPartial = false);

696

697

698

699

700

701

702

704

705

706

707

709

710

711

712

714

716 return PtrRtChecking.get();

717 }

718

719

720

722 return PtrRtChecking->getNumberOfChecks();

723 }

724

725

726

728 const Loop *TheLoop,

730

731

733

736

737

738

740

741

742

744

745

746

748 bool isWrite) const {

749 return DepChecker->getInstructionsForAccess(Ptr, isWrite);

750 }

751

752

753

755 return SymbolicStrides;

756 }

757

758

760

761

762

764 return HasStoreStoreDependenceInvolvingLoopInvariantAddress;

765 }

766

767

768

770 return HasLoadStoreDependenceInvolvingLoopInvariantAddress;

771 }

772

773

775 return StoresToInvariantAddresses;

776 }

777

778

779

780

781

782

784

785private:

786

787

790

791

792

793 bool canAnalyzeLoop();

794

795

796

797

798

799

802

803

804

805

806

807 void collectStridedAccess(Value *LoadOrStoreInst);

808

809

810

811

812 void emitUnsafeDependenceRemark();

813

814 std::unique_ptr PSE;

815

816

817

818

819

820

821 std::unique_ptr PtrRtChecking;

822

823

824

825

826

827 std::unique_ptr DepChecker;

828

829 Loop *TheLoop;

830

831

832 std::optionalScalarEvolution::LoopGuards LoopGuards;

833

834

835

836 bool AllowPartial;

837

838 unsigned NumLoads = 0;

839 unsigned NumStores = 0;

840

841

842 bool CanVecMem = false;

843 bool HasConvergentOp = false;

844 bool HasCompletePtrRtChecking = false;

845

846

847

848 bool HasStoreStoreDependenceInvolvingLoopInvariantAddress = false;

849

850

851 bool HasLoadStoreDependenceInvolvingLoopInvariantAddress = false;

852

853

855

856

857

858 std::unique_ptr Report;

859

860

861

863};

864

865

866

867

868

869

870

871

872

873

876 const DenseMap<Value *, const SCEV *> &PtrToStride,

877 Value *Ptr);

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894LLVM_ABI std::optional<int64_t>

895getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr,

896 const Loop *Lp, const DominatorTree &DT,

897 const DenseMap<Value *, const SCEV *> &StridesMap =

898 DenseMap<Value *, const SCEV *>(),

899 bool Assume = false, bool ShouldCheckWrap = true);

900

901

902

903

904

905

906LLVM_ABI std::optional<int64_t>

907getPointersDiff(Type *ElemTyA, Value *PtrA, Type *ElemTyB, Value *PtrB,

908 const DataLayout &DL, ScalarEvolution &SE,

909 bool StrictCheck = false, bool CheckType = true);

910

911

912

913

914

915

916

917

918

919

920

922 const DataLayout &DL, ScalarEvolution &SE,

923 SmallVectorImpl &SortedIndices);

924

925

926

928 ScalarEvolution &SE, bool CheckType = true);

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

947 const Loop *Lp, const SCEV *PtrExpr, Type *AccessTy, const SCEV *BTC,

948 const SCEV *MaxBTC, ScalarEvolution *SE,

949 DenseMap<std::pair<const SCEV *, Type *>,

950 std::pair<const SCEV *, const SCEV *>> *PointerBounds,

951 DominatorTree *DT, AssumptionCache *AC,

952 std::optionalScalarEvolution::LoopGuards &LoopGuards);

953

955

957

958

966

967public:

971 : SE(SE), AA(AA), DT(DT), LI(LI), TTI(TTI), TLI(TLI), AC(AC) {}

972

974

976

978 FunctionAnalysisManager::Invalidator &Inv);

979};

980

981

982

983

984

985

986

987

998

1003

1008

1009}

1010

1011#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

DXIL Forward Handle Accesses

Generic implementation of equivalence classes through the use Tarjan's efficient union-find algorithm...

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType(MVT::SimpleValueType VT, SDValue N, const TargetLowering *TLI, const DataLayout &DL)

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

A cache of @llvm.assume calls within a function.

LLVM Basic Block Representation.

A parsed version of the target data layout string in and methods for querying it.

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...

An instruction for reading from memory.

This analysis provides dependence information for the memory accesses of a loop.

Definition LoopAccessAnalysis.h:989

LoopAccessInfoManager Result

Definition LoopAccessAnalysis.h:994

LLVM_ABI Result run(Function &F, FunctionAnalysisManager &AM)

LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)

LoopAccessInfoManager(ScalarEvolution &SE, AAResults &AA, DominatorTree &DT, LoopInfo &LI, TargetTransformInfo *TTI, const TargetLibraryInfo *TLI, AssumptionCache *AC)

Definition LoopAccessAnalysis.h:968

LLVM_ABI const LoopAccessInfo & getInfo(Loop &L, bool AllowPartial=false)

Drive the analysis of memory accesses in the loop.

Definition LoopAccessAnalysis.h:689

const MemoryDepChecker & getDepChecker() const

the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences b...

Definition LoopAccessAnalysis.h:743

ArrayRef< StoreInst * > getStoresToInvariantAddresses() const

Return the list of stores to invariant addresses.

Definition LoopAccessAnalysis.h:774

const OptimizationRemarkAnalysis * getReport() const

The diagnostics report generated for the analysis.

Definition LoopAccessAnalysis.h:739

const RuntimePointerChecking * getRuntimePointerChecking() const

Definition LoopAccessAnalysis.h:715

bool canVectorizeMemory() const

Return true we can analyze the memory accesses in the loop and there are no memory dependence cycles.

Definition LoopAccessAnalysis.h:703

unsigned getNumLoads() const

Definition LoopAccessAnalysis.h:735

unsigned getNumRuntimePointerChecks() const

Number of memchecks required to prove independence of otherwise may-alias pointers.

Definition LoopAccessAnalysis.h:721

LLVM_ABI bool isInvariant(Value *V) const

Returns true if value V is loop invariant.

bool hasLoadStoreDependenceInvolvingLoopInvariantAddress() const

Return true if the loop has memory dependence involving a load and a store to an invariant address,...

Definition LoopAccessAnalysis.h:769

LLVM_ABI void print(raw_ostream &OS, unsigned Depth=0) const

Print the information about the memory accesses in the loop.

static LLVM_ABI bool blockNeedsPredication(const BasicBlock *BB, const Loop *TheLoop, const DominatorTree *DT)

Return true if the block BB needs to be predicated in order for the loop to be vectorized.

const PredicatedScalarEvolution & getPSE() const

Used to add runtime SCEV checks.

Definition LoopAccessAnalysis.h:783

LLVM_ABI LoopAccessInfo(Loop *L, ScalarEvolution *SE, const TargetTransformInfo *TTI, const TargetLibraryInfo *TLI, AAResults *AA, DominatorTree *DT, LoopInfo *LI, AssumptionCache *AC, bool AllowPartial=false)

unsigned getNumStores() const

Definition LoopAccessAnalysis.h:734

SmallVector< Instruction *, 4 > getInstructionsForAccess(Value *Ptr, bool isWrite) const

Return the list of instructions that use Ptr to read or write memory.

Definition LoopAccessAnalysis.h:747

const DenseMap< Value *, const SCEV * > & getSymbolicStrides() const

If an access has a symbolic strides, this maps the pointer value to the stride symbol.

Definition LoopAccessAnalysis.h:754

bool hasAllowPartial() const

Return true if, when runtime pointer checking does not have complete results, it instead has partial ...

Definition LoopAccessAnalysis.h:713

bool hasStoreStoreDependenceInvolvingLoopInvariantAddress() const

Return true if the loop has memory dependence involving two stores to an invariant address,...

Definition LoopAccessAnalysis.h:763

bool hasConvergentOp() const

Return true if there is a convergent operation in the loop.

Definition LoopAccessAnalysis.h:708

Represents a single loop in the control flow graph.

Checks memory dependences among accesses to the same underlying object to determine whether there vec...

Definition LoopAccessAnalysis.h:91

DominatorTree * getDT() const

Definition LoopAccessAnalysis.h:295

ArrayRef< unsigned > getOrderForAccess(Value *Ptr, bool IsWrite) const

Return the program order indices for the access location (Ptr, IsWrite).

Definition LoopAccessAnalysis.h:280

bool isSafeForAnyStoreLoadForwardDistances() const

Return true if there are no store-load forwarding dependencies.

Definition LoopAccessAnalysis.h:227

bool isSafeForAnyVectorWidth() const

Return true if the number of elements that are safe to operate on simultaneously is not bounded.

Definition LoopAccessAnalysis.h:216

LLVM_ABI bool areDepsSafe(const DepCandidates &AccessSets, const MemAccessInfoList &CheckDeps)

Check whether the dependencies between the accesses are safe, and records the dependence information ...

EquivalenceClasses< MemAccessInfo > DepCandidates

Set of potential dependent memory accesses.

Definition LoopAccessAnalysis.h:96

MemoryDepChecker(PredicatedScalarEvolution &PSE, AssumptionCache *AC, DominatorTree *DT, const Loop *L, const DenseMap< Value *, const SCEV * > &SymbolicStrides, unsigned MaxTargetVectorWidthInBits, std::optional< ScalarEvolution::LoopGuards > &LoopGuards)

Definition LoopAccessAnalysis.h:183

void clearDependences()

Definition LoopAccessAnalysis.h:255

const SmallVectorImpl< Instruction * > & getMemoryInstructions() const

The vector of memory access instructions.

Definition LoopAccessAnalysis.h:259

bool shouldRetryWithRuntimeChecks() const

In same cases when the dependency check fails we can still vectorize the loop with a dynamic array ac...

Definition LoopAccessAnalysis.h:243

const Loop * getInnermostLoop() const

Definition LoopAccessAnalysis.h:287

uint64_t getMaxSafeVectorWidthInBits() const

Return the number of elements that are safe to operate on simultaneously, multiplied by the size of t...

Definition LoopAccessAnalysis.h:222

bool isSafeForVectorization() const

No memory dependence was encountered that would inhibit vectorization.

Definition LoopAccessAnalysis.h:210

AssumptionCache * getAC() const

Definition LoopAccessAnalysis.h:299

const SmallVectorImpl< Dependence > * getDependences() const

Returns the memory dependences.

Definition LoopAccessAnalysis.h:251

DenseMap< std::pair< const SCEV *, Type * >, std::pair< const SCEV *, const SCEV * > > & getPointerBounds()

Definition LoopAccessAnalysis.h:291

SmallVector< MemAccessInfo, 8 > MemAccessInfoList

Definition LoopAccessAnalysis.h:94

LLVM_ABI SmallVector< Instruction *, 4 > getInstructionsForAccess(Value *Ptr, bool isWrite) const

Find the set of instructions that read or write via Ptr.

VectorizationSafetyStatus

Type to keep track of the status of the dependence check.

Definition LoopAccessAnalysis.h:101

@ Safe

Definition LoopAccessAnalysis.h:104

@ PossiblySafeWithRtChecks

Definition LoopAccessAnalysis.h:106

@ Unsafe

Definition LoopAccessAnalysis.h:108

LLVM_ABI void addAccess(StoreInst *SI)

Register the location (instructions are given increasing numbers) of a write access.

PointerIntPair< Value *, 1, bool > MemAccessInfo

Definition LoopAccessAnalysis.h:93

uint64_t getStoreLoadForwardSafeDistanceInBits() const

Return safe power-of-2 number of elements, which do not prevent store-load forwarding,...

Definition LoopAccessAnalysis.h:234

DenseMap< Instruction *, unsigned > generateInstructionOrderMap() const

Generate a mapping between the memory instructions and their indices according to program order.

Definition LoopAccessAnalysis.h:265

PointerIntPair - This class implements a pair of a pointer and small integer.

An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...

A set of analyses that are preserved following a run of a transformation pass.

Holds information about the memory runtime legality checks to verify that a group of pointers do not ...

Definition LoopAccessAnalysis.h:503

RuntimePointerChecking(MemoryDepChecker &DC, ScalarEvolution *SE, std::optional< ScalarEvolution::LoopGuards > &LoopGuards)

Definition LoopAccessAnalysis.h:536

bool Need

This flag indicates if we need to add the runtime check.

Definition LoopAccessAnalysis.h:603

void reset()

Reset the state of the pointer runtime information.

Definition LoopAccessAnalysis.h:541

unsigned getNumberOfChecks() const

Returns the number of run-time checks required according to needsChecking.

Definition LoopAccessAnalysis.h:592

LLVM_ABI void printChecks(raw_ostream &OS, const SmallVectorImpl< RuntimePointerCheck > &Checks, unsigned Depth=0) const

Print Checks.

LLVM_ABI bool needsChecking(const RuntimeCheckingPtrGroup &M, const RuntimeCheckingPtrGroup &N) const

Decide if we need to add a check between two groups of pointers, according to needsChecking.

LLVM_ABI void print(raw_ostream &OS, unsigned Depth=0) const

Print the list run-time memory checks necessary.

std::optional< ArrayRef< PointerDiffInfo > > getDiffChecks() const

Definition LoopAccessAnalysis.h:579

SmallVector< RuntimeCheckingPtrGroup, 2 > CheckingGroups

Holds a partitioning of pointers into "check groups".

Definition LoopAccessAnalysis.h:609

LLVM_ABI void generateChecks(MemoryDepChecker::DepCandidates &DepCands, bool UseDependencies)

Generate the checks and store it.

friend struct RuntimeCheckingPtrGroup

Definition LoopAccessAnalysis.h:504

static LLVM_ABI bool arePointersInSamePartition(const SmallVectorImpl< int > &PtrToPartition, unsigned PtrIdx1, unsigned PtrIdx2)

Check if pointers are in the same partition.

bool empty() const

No run-time memory checking is necessary.

Definition LoopAccessAnalysis.h:561

SmallVector< PointerInfo, 2 > Pointers

Information about the pointers that may require checking.

Definition LoopAccessAnalysis.h:606

ScalarEvolution * getSE() const

Definition LoopAccessAnalysis.h:628

LLVM_ABI void insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr, Type *AccessTy, bool WritePtr, unsigned DepSetId, unsigned ASId, PredicatedScalarEvolution &PSE, bool NeedsFreeze)

Insert a pointer and calculate the start and end SCEVs.

const SmallVectorImpl< RuntimePointerCheck > & getChecks() const

Returns the checks that generateChecks created.

Definition LoopAccessAnalysis.h:570

const PointerInfo & getPointerInfo(unsigned PtrIdx) const

Return PointerInfo for pointer at index PtrIdx.

Definition LoopAccessAnalysis.h:624

This class represents an analyzed expression in the program.

The main scalar evolution driver.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

An instruction for storing to memory.

StringRef - Represent a constant reference to a string, i.e.

Provides information about what library functions are available for the current target.

This pass provides access to the codegen interfaces that are needed for IR-level transformations.

Value handle that tracks a Value across RAUW.

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

This class implements an extremely fast bulk output stream that can only output to a stream.

Abstract Attribute helper functions.

This is an optimization pass for GlobalISel generic memory operations.

std::pair< const RuntimeCheckingPtrGroup *, const RuntimeCheckingPtrGroup * > RuntimePointerCheck

A memcheck which made up of a pair of grouped pointers.

Definition LoopAccessAnalysis.h:487

LLVM_ABI std::optional< int64_t > getPointersDiff(Type *ElemTyA, Value *PtrA, Type *ElemTyB, Value *PtrB, const DataLayout &DL, ScalarEvolution &SE, bool StrictCheck=false, bool CheckType=true)

Returns the distance between the pointers PtrA and PtrB iff they are compatible and it is possible to...

LLVM_ABI bool sortPtrAccesses(ArrayRef< Value * > VL, Type *ElemTy, const DataLayout &DL, ScalarEvolution &SE, SmallVectorImpl< unsigned > &SortedIndices)

Attempt to sort the pointers in VL and return the sorted indices in SortedIndices,...

LLVM_ABI const SCEV * replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE, const DenseMap< Value *, const SCEV * > &PtrToStride, Value *Ptr)

Return the SCEV corresponding to a pointer with the symbolic stride replaced with constant one,...

LLVM_ABI bool isConsecutiveAccess(Value *A, Value *B, const DataLayout &DL, ScalarEvolution &SE, bool CheckType=true)

Returns true if the memory operations A and B are consecutive.

ArrayRef(const T &OneElt) -> ArrayRef< T >

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.

LLVM_ABI std::pair< const SCEV *, const SCEV * > getStartAndEndForAccess(const Loop *Lp, const SCEV *PtrExpr, Type *AccessTy, const SCEV *BTC, const SCEV *MaxBTC, ScalarEvolution *SE, DenseMap< std::pair< const SCEV *, Type * >, std::pair< const SCEV *, const SCEV * > > *PointerBounds, DominatorTree *DT, AssumptionCache *AC, std::optional< ScalarEvolution::LoopGuards > &LoopGuards)

Calculate Start and End points of memory access using exact backedge taken count BTC if computable or...

LLVM_ABI std::optional< int64_t > getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr, const Loop *Lp, const DominatorTree &DT, const DenseMap< Value *, const SCEV * > &StridesMap=DenseMap< Value *, const SCEV * >(), bool Assume=false, bool ShouldCheckWrap=true)

If the pointer has a constant stride return it in units of the access type size.

IR Values for the lower and upper bounds of a pointer evolution.

A CRTP mix-in that provides informational APIs needed for analysis passes.

A special type used by analysis passes to provide an address that identifies that particular analysis...

Instruction * getDestination(const MemoryDepChecker &DepChecker) const

Return the destination instruction of the dependence.

Definition LoopAccessAnalysis.h:1004

DepType Type

The type of the dependence.

Definition LoopAccessAnalysis.h:155

unsigned Destination

Index of the destination of the dependence in the InstMap vector.

Definition LoopAccessAnalysis.h:153

Dependence(unsigned Source, unsigned Destination, DepType Type)

Definition LoopAccessAnalysis.h:157

LLVM_ABI bool isPossiblyBackward() const

May be a lexically backward dependence type (includes Unknown).

Instruction * getSource(const MemoryDepChecker &DepChecker) const

Return the source instruction of the dependence.

Definition LoopAccessAnalysis.h:999

LLVM_ABI bool isForward() const

Lexically forward dependence.

LLVM_ABI bool isBackward() const

Lexically backward dependence.

LLVM_ABI void print(raw_ostream &OS, unsigned Depth, const SmallVectorImpl< Instruction * > &Instrs) const

Print the dependence.

unsigned Source

Index of the source of the dependence in the InstMap vector.

Definition LoopAccessAnalysis.h:151

DepType

The type of the dependence.

Definition LoopAccessAnalysis.h:114

@ IndirectUnsafe

Definition LoopAccessAnalysis.h:123

@ Forward

Definition LoopAccessAnalysis.h:134

@ BackwardVectorizableButPreventsForwarding

Definition LoopAccessAnalysis.h:144

@ BackwardVectorizable

Definition LoopAccessAnalysis.h:142

@ Unknown

Definition LoopAccessAnalysis.h:118

@ Backward

Definition LoopAccessAnalysis.h:139

@ NoDep

Definition LoopAccessAnalysis.h:116

@ ForwardButPreventsForwarding

Definition LoopAccessAnalysis.h:137

static LLVM_ABI const char * DepName[]

String version of the types.

Definition LoopAccessAnalysis.h:148

PointerDiffInfo(const SCEV *SrcStart, const SCEV *SinkStart, unsigned AccessSize, bool NeedsFreeze)

Definition LoopAccessAnalysis.h:495

unsigned AccessSize

Definition LoopAccessAnalysis.h:492

const SCEV * SinkStart

Definition LoopAccessAnalysis.h:491

const SCEV * SrcStart

Definition LoopAccessAnalysis.h:490

bool NeedsFreeze

Definition LoopAccessAnalysis.h:493

A grouping of pointers.

Definition LoopAccessAnalysis.h:453

unsigned AddressSpace

Address space of the involved pointers.

Definition LoopAccessAnalysis.h:478

LLVM_ABI bool addPointer(unsigned Index, const RuntimePointerChecking &RtCheck)

Tries to add the pointer recorded in RtCheck at index Index to this pointer checking group.

bool NeedsFreeze

Whether the pointer needs to be frozen after expansion, e.g.

Definition LoopAccessAnalysis.h:481

LLVM_ABI RuntimeCheckingPtrGroup(unsigned Index, const RuntimePointerChecking &RtCheck)

Create a new pointer checking group containing a single pointer, with index Index in RtCheck.

const SCEV * High

The SCEV expression which represents the upper bound of all the pointers in this group.

Definition LoopAccessAnalysis.h:471

SmallVector< unsigned, 2 > Members

Indices of all the pointers that constitute this grouping.

Definition LoopAccessAnalysis.h:476

const SCEV * Low

The SCEV expression which represents the lower bound of all the pointers in this group.

Definition LoopAccessAnalysis.h:474

PointerInfo(Value *PointerValue, const SCEV *Start, const SCEV *End, bool IsWritePtr, unsigned DependencySetId, unsigned AliasSetId, const SCEV *Expr, bool NeedsFreeze)

Definition LoopAccessAnalysis.h:528

const SCEV * Start

Holds the smallest byte address accessed by the pointer throughout all iterations of the loop.

Definition LoopAccessAnalysis.h:512

const SCEV * Expr

SCEV for the access.

Definition LoopAccessAnalysis.h:524

bool NeedsFreeze

True if the pointer expressions needs to be frozen after expansion.

Definition LoopAccessAnalysis.h:526

bool IsWritePtr

Holds the information if this pointer is used for writing to memory.

Definition LoopAccessAnalysis.h:517

unsigned DependencySetId

Holds the id of the set of pointers that could be dependent because of a shared underlying object.

Definition LoopAccessAnalysis.h:520

unsigned AliasSetId

Holds the id of the disjoint alias set to which this pointer belongs.

Definition LoopAccessAnalysis.h:522

const SCEV * End

Holds the largest byte address accessed by the pointer throughout all iterations of the loop,...

Definition LoopAccessAnalysis.h:515

TrackingVH< Value > PointerValue

Holds the pointer value that we need to check.

Definition LoopAccessAnalysis.h:509

Collection of parameters shared beetween the Loop Vectorizer and the Loop Access Analysis.

Definition LoopAccessAnalysis.h:34

static LLVM_ABI const unsigned MaxVectorWidth

Maximum SIMD width.

Definition LoopAccessAnalysis.h:36

static LLVM_ABI unsigned VectorizationFactor

VF as overridden by the user.

Definition LoopAccessAnalysis.h:39

static LLVM_ABI unsigned RuntimeMemoryCheckThreshold

\When performing memory disambiguation checks at runtime do not make more than this number of compari...

Definition LoopAccessAnalysis.h:47

static LLVM_ABI bool isInterleaveForced()

True if force-vector-interleave was specified by the user.

static LLVM_ABI unsigned VectorizationInterleave

Interleave factor as overridden by the user.

Definition LoopAccessAnalysis.h:41

static LLVM_ABI bool HoistRuntimeChecks

Definition LoopAccessAnalysis.h:54