LLVM 24.0.0git
SLPMemoryUtils.h
Go to the documentation of this file.
1//===- SLPMemoryUtils.h - SLP pointer/stride helpers -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Internal header used by SLPVectorizer.cpp. It declares free pointer and
10// stride helpers that do not depend on BoUpSLP or any other SLP-private type.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPMEMORYUTILS_H
15#define LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPMEMORYUTILS_H
16
17#include "llvm/ADT/ArrayRef.h"
19
20namespace llvm {
21class DataLayout;
22class SCEV;
23class ScalarEvolution;
25class Type;
26class Value;
27} // namespace llvm
28
29namespace llvm::slpvectorizer {
30
31/// \p MaxDepth is the recursion limit for getUnderlyingObject.
32bool arePointersCompatible(Value *Ptr1, Value *Ptr2,
33 const TargetLibraryInfo &TLI, unsigned MaxDepth,
34 bool CompareOpcodes = true);
35
36/// Calculates minimal alignment as a common alignment.
37template <typename T> Align computeCommonAlignment(ArrayRef<Value *> VL);
38
39/// Checks if the provided list of pointers \p Pointers represents the strided
40/// pointers for type ElemTy. If they are not, nullptr is returned.
41/// Otherwise, SCEV* of the stride value is returned.
42/// If `PointerOps` can be rearranged into the following sequence:
43/// ```
44/// %x + c_0 * stride,
45/// %x + c_1 * stride,
46/// %x + c_2 * stride
47/// ...
48/// ```
49/// where each `c_i` is constant. The SCEV of the `stride` will be returned.
50const SCEV *calculateRtStride(ArrayRef<Value *> PointerOps, Type *ElemTy,
51 const DataLayout &DL, ScalarEvolution &SE,
52 SmallVectorImpl<unsigned> &SortedIndices);
53
54} // namespace llvm::slpvectorizer
55
56#endif // LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPMEMORYUTILS_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
This class represents an analyzed expression in the program.
The main scalar evolution driver.
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
A private "module" namespace for types and utilities used by this pass.
Align computeCommonAlignment(ArrayRef< Value * > VL)
Calculates minimal alignment as a common alignment.
const SCEV * calculateRtStride(ArrayRef< Value * > PointerOps, Type *ElemTy, const DataLayout &DL, ScalarEvolution &SE, SmallVectorImpl< unsigned > &SortedIndices)
Checks if the provided list of pointers Pointers represents the strided pointers for type ElemTy.
bool arePointersCompatible(Value *Ptr1, Value *Ptr2, const TargetLibraryInfo &TLI, unsigned MaxDepth, bool CompareOpcodes)
MaxDepth is the recursion limit for getUnderlyingObject.
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
ArrayRef(const T &OneElt) -> ArrayRef< T >