mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[IndVarSimplify][SimplifyIndVar] Move WidenIV to Utils/SimplifyIndVar. NFCI.
This moves WidenIV from IndVarSimplify to Utils/SimplifyIndVar so that we have createWideIV available as a generic helper utility. I.e., this is not only useful in IndVarSimplify, but could be useful for loop transformations. For example, motivation for this refactoring is the loop flatten transformation: if induction variables in a loop nest can be widened, we can avoid having to perform certain overflow checks, enabling this transformation. Differential Revision: https://reviews.llvm.org/D90421
This commit is contained in:
parent
4cbfba9811
commit
b3fbd56f82
@ -15,6 +15,8 @@
|
||||
#ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
|
||||
#define LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
|
||||
|
||||
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
|
||||
#include "llvm/IR/ConstantRange.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
|
||||
namespace llvm {
|
||||
@ -57,6 +59,27 @@ bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
|
||||
LoopInfo *LI, const TargetTransformInfo *TTI,
|
||||
SmallVectorImpl<WeakTrackingVH> &Dead);
|
||||
|
||||
/// Collect information about induction variables that are used by sign/zero
|
||||
/// extend operations. This information is recorded by CollectExtend and provides
|
||||
/// the input to WidenIV.
|
||||
struct WideIVInfo {
|
||||
PHINode *NarrowIV = nullptr;
|
||||
|
||||
// Widest integer type created [sz]ext
|
||||
Type *WidestNativeType = nullptr;
|
||||
|
||||
// Was a sext user seen before a zext?
|
||||
bool IsSigned = false;
|
||||
};
|
||||
|
||||
/// Widen Induction Variables - Extend the width of an IV to cover its
|
||||
/// widest uses.
|
||||
PHINode *createWideIV(WideIVInfo &WI,
|
||||
LoopInfo *LI, ScalarEvolution *SE, SCEVExpander &Rewriter,
|
||||
DominatorTree *DT, SmallVectorImpl<WeakTrackingVH> &DeadInsts,
|
||||
unsigned &NumElimExt, unsigned &NumWidened,
|
||||
bool HasGuards, bool UsePostIncrementRanges);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user