LLVM  10.0.0svn
AlignmentFromAssumptions.cpp
Go to the documentation of this file.
1 //===----------------------- AlignmentFromAssumptions.cpp -----------------===//
2 // Set Load/Store Alignments From Assumptions
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements a ScalarEvolution-based transformation to set
11 // the alignments of load, stores and memory intrinsics based on the truth
12 // expressions of assume intrinsics. The primary motivation is to handle
13 // complex alignment assumptions that apply to vector loads and stores that
14 // appear after vectorization and unrolling.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #define AA_NAME "alignment-from-assumptions"
19 #define DEBUG_TYPE AA_NAME
21 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/ADT/Statistic.h"
26 #include "llvm/Analysis/LoopInfo.h"
29 #include "llvm/IR/Constant.h"
30 #include "llvm/IR/Dominators.h"
31 #include "llvm/IR/Instruction.h"
32 #include "llvm/IR/Intrinsics.h"
33 #include "llvm/IR/Module.h"
34 #include "llvm/Support/Debug.h"
36 #include "llvm/Transforms/Scalar.h"
37 using namespace llvm;
38 
39 STATISTIC(NumLoadAlignChanged,
40  "Number of loads changed by alignment assumptions");
41 STATISTIC(NumStoreAlignChanged,
42  "Number of stores changed by alignment assumptions");
43 STATISTIC(NumMemIntAlignChanged,
44  "Number of memory intrinsics changed by alignment assumptions");
45 
46 namespace {
47 struct AlignmentFromAssumptions : public FunctionPass {
48  static char ID; // Pass identification, replacement for typeid
49  AlignmentFromAssumptions() : FunctionPass(ID) {
51  }
52 
53  bool runOnFunction(Function &F) override;
54 
55  void getAnalysisUsage(AnalysisUsage &AU) const override {
59 
60  AU.setPreservesCFG();
66  }
67 
69 };
70 }
71 
73 static const char aip_name[] = "Alignment from assumptions";
74 INITIALIZE_PASS_BEGIN(AlignmentFromAssumptions, AA_NAME,
75  aip_name, false, false)
79 INITIALIZE_PASS_END(AlignmentFromAssumptions, AA_NAME,
80  aip_name, false, false)
81 
83  return new AlignmentFromAssumptions();
84 }
85 
86 // Given an expression for the (constant) alignment, AlignSCEV, and an
87 // expression for the displacement between a pointer and the aligned address,
88 // DiffSCEV, compute the alignment of the displaced pointer if it can be reduced
89 // to a constant. Using SCEV to compute alignment handles the case where
90 // DiffSCEV is a recurrence with constant start such that the aligned offset
91 // is constant. e.g. {16,+,32} % 32 -> 16.
92 static unsigned getNewAlignmentDiff(const SCEV *DiffSCEV,
93  const SCEV *AlignSCEV,
94  ScalarEvolution *SE) {
95  // DiffUnits = Diff % int64_t(Alignment)
96  const SCEV *DiffAlignDiv = SE->getUDivExpr(DiffSCEV, AlignSCEV);
97  const SCEV *DiffAlign = SE->getMulExpr(DiffAlignDiv, AlignSCEV);
98  const SCEV *DiffUnitsSCEV = SE->getMinusSCEV(DiffAlign, DiffSCEV);
99 
100  LLVM_DEBUG(dbgs() << "\talignment relative to " << *AlignSCEV << " is "
101  << *DiffUnitsSCEV << " (diff: " << *DiffSCEV << ")\n");
102 
103  if (const SCEVConstant *ConstDUSCEV =
104  dyn_cast<SCEVConstant>(DiffUnitsSCEV)) {
105  int64_t DiffUnits = ConstDUSCEV->getValue()->getSExtValue();
106 
107  // If the displacement is an exact multiple of the alignment, then the
108  // displaced pointer has the same alignment as the aligned pointer, so
109  // return the alignment value.
110  if (!DiffUnits)
111  return (unsigned)
112  cast<SCEVConstant>(AlignSCEV)->getValue()->getSExtValue();
113 
114  // If the displacement is not an exact multiple, but the remainder is a
115  // constant, then return this remainder (but only if it is a power of 2).
116  uint64_t DiffUnitsAbs = std::abs(DiffUnits);
117  if (isPowerOf2_64(DiffUnitsAbs))
118  return (unsigned) DiffUnitsAbs;
119  }
120 
121  return 0;
122 }
123 
124 // There is an address given by an offset OffSCEV from AASCEV which has an
125 // alignment AlignSCEV. Use that information, if possible, to compute a new
126 // alignment for Ptr.
127 static unsigned getNewAlignment(const SCEV *AASCEV, const SCEV *AlignSCEV,
128  const SCEV *OffSCEV, Value *Ptr,
129  ScalarEvolution *SE) {
130  const SCEV *PtrSCEV = SE->getSCEV(Ptr);
131  const SCEV *DiffSCEV = SE->getMinusSCEV(PtrSCEV, AASCEV);
132 
133  // On 32-bit platforms, DiffSCEV might now have type i32 -- we've always
134  // sign-extended OffSCEV to i64, so make sure they agree again.
135  DiffSCEV = SE->getNoopOrSignExtend(DiffSCEV, OffSCEV->getType());
136 
137  // What we really want to know is the overall offset to the aligned
138  // address. This address is displaced by the provided offset.
139  DiffSCEV = SE->getMinusSCEV(DiffSCEV, OffSCEV);
140 
141  LLVM_DEBUG(dbgs() << "AFI: alignment of " << *Ptr << " relative to "
142  << *AlignSCEV << " and offset " << *OffSCEV
143  << " using diff " << *DiffSCEV << "\n");
144 
145  unsigned NewAlignment = getNewAlignmentDiff(DiffSCEV, AlignSCEV, SE);
146  LLVM_DEBUG(dbgs() << "\tnew alignment: " << NewAlignment << "\n");
147 
148  if (NewAlignment) {
149  return NewAlignment;
150  } else if (const SCEVAddRecExpr *DiffARSCEV =
151  dyn_cast<SCEVAddRecExpr>(DiffSCEV)) {
152  // The relative offset to the alignment assumption did not yield a constant,
153  // but we should try harder: if we assume that a is 32-byte aligned, then in
154  // for (i = 0; i < 1024; i += 4) r += a[i]; not all of the loads from a are
155  // 32-byte aligned, but instead alternate between 32 and 16-byte alignment.
156  // As a result, the new alignment will not be a constant, but can still
157  // be improved over the default (of 4) to 16.
158 
159  const SCEV *DiffStartSCEV = DiffARSCEV->getStart();
160  const SCEV *DiffIncSCEV = DiffARSCEV->getStepRecurrence(*SE);
161 
162  LLVM_DEBUG(dbgs() << "\ttrying start/inc alignment using start "
163  << *DiffStartSCEV << " and inc " << *DiffIncSCEV << "\n");
164 
165  // Now compute the new alignment using the displacement to the value in the
166  // first iteration, and also the alignment using the per-iteration delta.
167  // If these are the same, then use that answer. Otherwise, use the smaller
168  // one, but only if it divides the larger one.
169  NewAlignment = getNewAlignmentDiff(DiffStartSCEV, AlignSCEV, SE);
170  unsigned NewIncAlignment = getNewAlignmentDiff(DiffIncSCEV, AlignSCEV, SE);
171 
172  LLVM_DEBUG(dbgs() << "\tnew start alignment: " << NewAlignment << "\n");
173  LLVM_DEBUG(dbgs() << "\tnew inc alignment: " << NewIncAlignment << "\n");
174 
175  if (!NewAlignment || !NewIncAlignment) {
176  return 0;
177  } else if (NewAlignment > NewIncAlignment) {
178  if (NewAlignment % NewIncAlignment == 0) {
179  LLVM_DEBUG(dbgs() << "\tnew start/inc alignment: " << NewIncAlignment
180  << "\n");
181  return NewIncAlignment;
182  }
183  } else if (NewIncAlignment > NewAlignment) {
184  if (NewIncAlignment % NewAlignment == 0) {
185  LLVM_DEBUG(dbgs() << "\tnew start/inc alignment: " << NewAlignment
186  << "\n");
187  return NewAlignment;
188  }
189  } else if (NewIncAlignment == NewAlignment) {
190  LLVM_DEBUG(dbgs() << "\tnew start/inc alignment: " << NewAlignment
191  << "\n");
192  return NewAlignment;
193  }
194  }
195 
196  return 0;
197 }
198 
200  Value *&AAPtr,
201  const SCEV *&AlignSCEV,
202  const SCEV *&OffSCEV) {
203  // An alignment assume must be a statement about the least-significant
204  // bits of the pointer being zero, possibly with some offset.
205  ICmpInst *ICI = dyn_cast<ICmpInst>(I->getArgOperand(0));
206  if (!ICI)
207  return false;
208 
209  // This must be an expression of the form: x & m == 0.
210  if (ICI->getPredicate() != ICmpInst::ICMP_EQ)
211  return false;
212 
213  // Swap things around so that the RHS is 0.
214  Value *CmpLHS = ICI->getOperand(0);
215  Value *CmpRHS = ICI->getOperand(1);
216  const SCEV *CmpLHSSCEV = SE->getSCEV(CmpLHS);
217  const SCEV *CmpRHSSCEV = SE->getSCEV(CmpRHS);
218  if (CmpLHSSCEV->isZero())
219  std::swap(CmpLHS, CmpRHS);
220  else if (!CmpRHSSCEV->isZero())
221  return false;
222 
223  BinaryOperator *CmpBO = dyn_cast<BinaryOperator>(CmpLHS);
224  if (!CmpBO || CmpBO->getOpcode() != Instruction::And)
225  return false;
226 
227  // Swap things around so that the right operand of the and is a constant
228  // (the mask); we cannot deal with variable masks.
229  Value *AndLHS = CmpBO->getOperand(0);
230  Value *AndRHS = CmpBO->getOperand(1);
231  const SCEV *AndLHSSCEV = SE->getSCEV(AndLHS);
232  const SCEV *AndRHSSCEV = SE->getSCEV(AndRHS);
233  if (isa<SCEVConstant>(AndLHSSCEV)) {
234  std::swap(AndLHS, AndRHS);
235  std::swap(AndLHSSCEV, AndRHSSCEV);
236  }
237 
238  const SCEVConstant *MaskSCEV = dyn_cast<SCEVConstant>(AndRHSSCEV);
239  if (!MaskSCEV)
240  return false;
241 
242  // The mask must have some trailing ones (otherwise the condition is
243  // trivial and tells us nothing about the alignment of the left operand).
244  unsigned TrailingOnes = MaskSCEV->getAPInt().countTrailingOnes();
245  if (!TrailingOnes)
246  return false;
247 
248  // Cap the alignment at the maximum with which LLVM can deal (and make sure
249  // we don't overflow the shift).
250  uint64_t Alignment;
251  TrailingOnes = std::min(TrailingOnes,
252  unsigned(sizeof(unsigned) * CHAR_BIT - 1));
253  Alignment = std::min(1u << TrailingOnes, +Value::MaximumAlignment);
254 
255  Type *Int64Ty = Type::getInt64Ty(I->getParent()->getParent()->getContext());
256  AlignSCEV = SE->getConstant(Int64Ty, Alignment);
257 
258  // The LHS might be a ptrtoint instruction, or it might be the pointer
259  // with an offset.
260  AAPtr = nullptr;
261  OffSCEV = nullptr;
262  if (PtrToIntInst *PToI = dyn_cast<PtrToIntInst>(AndLHS)) {
263  AAPtr = PToI->getPointerOperand();
264  OffSCEV = SE->getZero(Int64Ty);
265  } else if (const SCEVAddExpr* AndLHSAddSCEV =
266  dyn_cast<SCEVAddExpr>(AndLHSSCEV)) {
267  // Try to find the ptrtoint; subtract it and the rest is the offset.
268  for (SCEVAddExpr::op_iterator J = AndLHSAddSCEV->op_begin(),
269  JE = AndLHSAddSCEV->op_end(); J != JE; ++J)
270  if (const SCEVUnknown *OpUnk = dyn_cast<SCEVUnknown>(*J))
271  if (PtrToIntInst *PToI = dyn_cast<PtrToIntInst>(OpUnk->getValue())) {
272  AAPtr = PToI->getPointerOperand();
273  OffSCEV = SE->getMinusSCEV(AndLHSAddSCEV, *J);
274  break;
275  }
276  }
277 
278  if (!AAPtr)
279  return false;
280 
281  // Sign extend the offset to 64 bits (so that it is like all of the other
282  // expressions).
283  unsigned OffSCEVBits = OffSCEV->getType()->getPrimitiveSizeInBits();
284  if (OffSCEVBits < 64)
285  OffSCEV = SE->getSignExtendExpr(OffSCEV, Int64Ty);
286  else if (OffSCEVBits > 64)
287  return false;
288 
289  AAPtr = AAPtr->stripPointerCasts();
290  return true;
291 }
292 
294  Value *AAPtr;
295  const SCEV *AlignSCEV, *OffSCEV;
296  if (!extractAlignmentInfo(ACall, AAPtr, AlignSCEV, OffSCEV))
297  return false;
298 
299  // Skip ConstantPointerNull and UndefValue. Assumptions on these shouldn't
300  // affect other users.
301  if (isa<ConstantData>(AAPtr))
302  return false;
303 
304  const SCEV *AASCEV = SE->getSCEV(AAPtr);
305 
306  // Apply the assumption to all other users of the specified pointer.
309  for (User *J : AAPtr->users()) {
310  if (J == ACall)
311  continue;
312 
313  if (Instruction *K = dyn_cast<Instruction>(J))
314  if (isValidAssumeForContext(ACall, K, DT))
315  WorkList.push_back(K);
316  }
317 
318  while (!WorkList.empty()) {
319  Instruction *J = WorkList.pop_back_val();
320 
321  if (LoadInst *LI = dyn_cast<LoadInst>(J)) {
322  unsigned NewAlignment = getNewAlignment(AASCEV, AlignSCEV, OffSCEV,
323  LI->getPointerOperand(), SE);
324 
325  if (NewAlignment > LI->getAlignment()) {
326  LI->setAlignment(NewAlignment);
327  ++NumLoadAlignChanged;
328  }
329  } else if (StoreInst *SI = dyn_cast<StoreInst>(J)) {
330  unsigned NewAlignment = getNewAlignment(AASCEV, AlignSCEV, OffSCEV,
331  SI->getPointerOperand(), SE);
332 
333  if (NewAlignment > SI->getAlignment()) {
334  SI->setAlignment(NewAlignment);
335  ++NumStoreAlignChanged;
336  }
337  } else if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(J)) {
338  unsigned NewDestAlignment = getNewAlignment(AASCEV, AlignSCEV, OffSCEV,
339  MI->getDest(), SE);
340 
341  LLVM_DEBUG(dbgs() << "\tmem inst: " << NewDestAlignment << "\n";);
342  if (NewDestAlignment > MI->getDestAlignment()) {
343  MI->setDestAlignment(NewDestAlignment);
344  ++NumMemIntAlignChanged;
345  }
346 
347  // For memory transfers, there is also a source alignment that
348  // can be set.
349  if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(MI)) {
350  unsigned NewSrcAlignment = getNewAlignment(AASCEV, AlignSCEV, OffSCEV,
351  MTI->getSource(), SE);
352 
353  LLVM_DEBUG(dbgs() << "\tmem trans: " << NewSrcAlignment << "\n";);
354 
355  if (NewSrcAlignment > MTI->getSourceAlignment()) {
356  MTI->setSourceAlignment(NewSrcAlignment);
357  ++NumMemIntAlignChanged;
358  }
359  }
360  }
361 
362  // Now that we've updated that use of the pointer, look for other uses of
363  // the pointer to update.
364  Visited.insert(J);
365  for (User *UJ : J->users()) {
366  Instruction *K = cast<Instruction>(UJ);
367  if (!Visited.count(K) && isValidAssumeForContext(ACall, K, DT))
368  WorkList.push_back(K);
369  }
370  }
371 
372  return true;
373 }
374 
376  if (skipFunction(F))
377  return false;
378 
379  auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
380  ScalarEvolution *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
381  DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
382 
383  return Impl.runImpl(F, AC, SE, DT);
384 }
385 
387  ScalarEvolution *SE_,
388  DominatorTree *DT_) {
389  SE = SE_;
390  DT = DT_;
391 
392  bool Changed = false;
393  for (auto &AssumeVH : AC.assumptions())
394  if (AssumeVH)
395  Changed |= processAssumption(cast<CallInst>(AssumeVH));
396 
397  return Changed;
398 }
399 
402 
406  if (!runImpl(F, AC, &SE, &DT))
407  return PreservedAnalyses::all();
408 
410  PA.preserveSet<CFGAnalyses>();
411  PA.preserve<AAManager>();
413  PA.preserve<GlobalsAA>();
414  return PA;
415 }
Legacy wrapper pass to provide the GlobalsAAResult object.
INITIALIZE_PASS_BEGIN(AlignmentFromAssumptions, AA_NAME, aip_name, false, false) INITIALIZE_PASS_END(AlignmentFromAssumptions
static bool runImpl(Function &F, TargetLibraryInfo &TLI, DominatorTree &DT)
This is the entry point for all transforms.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:776
This class represents lattice values for constants.
Definition: AllocatorList.h:23
BinaryOps getOpcode() const
Definition: InstrTypes.h:402
This is the interface for a simple mod/ref and alias analysis over globals.
static unsigned getNewAlignment(const SCEV *AASCEV, const SCEV *AlignSCEV, const SCEV *OffSCEV, Value *Ptr, ScalarEvolution *SE)
void push_back(const T &Elt)
Definition: SmallVector.h:211
The main scalar evolution driver.
bool isZero() const
Return true if the expression is a constant zero.
This class represents a function call, abstracting a target machine&#39;s calling convention.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
bool isValidAssumeForContext(const Instruction *I, const Instruction *CxtI, const DominatorTree *DT=nullptr)
Return true if it is valid to use the assumptions provided by an assume intrinsic, I, at the point in the control-flow identified by the context instruction, CxtI.
STATISTIC(NumFunctions, "Total number of functions")
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:230
F(f)
An instruction for reading from memory.
Definition: Instructions.h:167
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:176
FunctionPass * createAlignmentFromAssumptionsPass()
MutableArrayRef< WeakTrackingVH > assumptions()
Access the list of assumption handles currently tracked for this function.
Value * getArgOperand(unsigned i) const
Definition: InstrTypes.h:1241
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:50
static const unsigned MaximumAlignment
Definition: Value.h:635
This class represents a cast from a pointer to an integer.
const APInt & getAPInt() const
This node represents a polynomial recurrence on the trip count of the specified loop.
An instruction for storing to memory.
Definition: Instructions.h:320
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:144
Value * getOperand(unsigned i) const
Definition: User.h:169
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static bool runOnFunction(Function &F, bool PostInlining)
This means that we are dealing with an entirely unknown SCEV value, and only represent it as its LLVM...
#define AA_NAME
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
static const char aip_name[]
A manager for alias analyses.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:370
Represent the analysis usage information of a pass.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Definition: MathExtras.h:433
This instruction compares its operands according to the predicate given to the constructor.
Analysis pass providing a never-invalidated alias analysis result.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:284
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition: SmallPtrSet.h:381
const SCEV * getMinusSCEV(const SCEV *LHS, const SCEV *RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS. Minus is represented in SCEV as A+B*-1.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Definition: Function.cpp:205
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
Definition: Value.cpp:535
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:159
const SCEV * getMulExpr(SmallVectorImpl< const SCEV *> &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical multiply expression, or something simpler if possible.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
A function analysis which provides an AssumptionCache.
This is the common base class for memset/memcpy/memmove.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Definition: SmallPtrSet.h:417
Type * getType() const
Return the LLVM type of this SCEV expression.
const SCEV *const * op_iterator
Module.h This file contains the declarations for the Module class.
const SCEV * getNoopOrSignExtend(const SCEV *V, Type *Ty)
Return a SCEV corresponding to a conversion of the input value to the specified type.
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:374
void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition: Pass.cpp:301
bool extractAlignmentInfo(CallInst *I, Value *&AAPtr, const SCEV *&AlignSCEV, const SCEV *&OffSCEV)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:940
unsigned countTrailingOnes() const
Count the number of trailing one bits.
Definition: APInt.h:1645
This node represents an addition of some number of SCEVs.
iterator_range< user_iterator > users()
Definition: Value.h:399
Represents analyses that only rely on functions&#39; control flow.
Definition: PassManager.h:114
Analysis pass that exposes the ScalarEvolution for a function.
Predicate getPredicate() const
Return the predicate for this instruction.
Definition: InstrTypes.h:807
This class wraps the llvm.memcpy/memmove intrinsics.
This class represents an analyzed expression in the program.
static unsigned getNewAlignmentDiff(const SCEV *DiffSCEV, const SCEV *AlignSCEV, ScalarEvolution *SE)
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:55
void preserveSet()
Mark an analysis set as preserved.
Definition: PassManager.h:189
const Function * getParent() const
Return the enclosing method, or null if none.
Definition: BasicBlock.h:106
#define I(x, y, z)
Definition: MD5.cpp:58
void initializeAlignmentFromAssumptionsPass(PassRegistry &)
APFloat abs(APFloat X)
Returns the absolute value of the argument.
Definition: APFloat.h:1223
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:332
void preserve()
Mark an analysis as preserved.
Definition: PassManager.h:174
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition: Type.cpp:114
LLVM Value Representation.
Definition: Value.h:72
const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
const SCEV * getUDivExpr(const SCEV *LHS, const SCEV *RHS)
Get a canonical unsigned division expression, or something simpler if possible.
The legacy pass manager&#39;s analysis pass to compute loop information.
Definition: LoopInfo.h:1177
IRTranslator LLVM IR MI
bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_, DominatorTree *DT_)
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:259
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
#define LLVM_DEBUG(X)
Definition: Debug.h:122
const BasicBlock * getParent() const
Definition: Instruction.h:66
This class represents a constant integer value.