summaryrefslogtreecommitdiff
path: root/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-07-29 00:56:56 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-07-29 00:56:56 +0000
commitab637ccbc099c506620fe50c32fc4ad231a23936 (patch)
tree6c9e6e13b1690c6e392f23b79048123033c981cb /lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
parentb5b38546f9b014b09ba82f43bf29a81c0619e1e1 (diff)
[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp')
-rw-r--r--lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp182
1 files changed, 98 insertions, 84 deletions
diff --git a/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
index f82ad6cb3da..7455a02b06d 100644
--- a/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
+++ b/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
@@ -1,4 +1,4 @@
-//===--- HexagonLoopIdiomRecognition.cpp ----------------------------------===//
+//===- HexagonLoopIdiomRecognition.cpp ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -9,28 +9,66 @@
#define DEBUG_TYPE "hexagon-lir"
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/InstructionSimplify.h"
+#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
+#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/User.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
-
#include <algorithm>
#include <array>
+#include <cassert>
+#include <cstdint>
+#include <cstdlib>
+#include <deque>
+#include <functional>
+#include <iterator>
+#include <map>
+#include <set>
+#include <utility>
+#include <vector>
using namespace llvm;
@@ -67,17 +105,22 @@ static const char *HexagonVolatileMemcpyName
namespace llvm {
+
void initializeHexagonLoopIdiomRecognizePass(PassRegistry&);
Pass *createHexagonLoopIdiomPass();
-}
+
+} // end namespace llvm
namespace {
+
class HexagonLoopIdiomRecognize : public LoopPass {
public:
static char ID;
+
explicit HexagonLoopIdiomRecognize() : LoopPass(ID) {
initializeHexagonLoopIdiomRecognizePass(*PassRegistry::getPassRegistry());
}
+
StringRef getPassName() const override {
return "Recognize Hexagon-specific loop idioms";
}
@@ -116,26 +159,9 @@ namespace {
ScalarEvolution *SE;
bool HasMemcpy, HasMemmove;
};
-}
-
-char HexagonLoopIdiomRecognize::ID = 0;
-INITIALIZE_PASS_BEGIN(HexagonLoopIdiomRecognize, "hexagon-loop-idiom",
- "Recognize Hexagon-specific loop idioms", false, false)
-INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
-INITIALIZE_PASS_DEPENDENCY(LCSSAWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
-INITIALIZE_PASS_END(HexagonLoopIdiomRecognize, "hexagon-loop-idiom",
- "Recognize Hexagon-specific loop idioms", false, false)
-
-
-namespace {
struct Simplifier {
- typedef std::function<Value* (Instruction*, LLVMContext&)> Rule;
+ using Rule = std::function<Value * (Instruction *, LLVMContext &)>;
void addRule(const Rule &R) { Rules.push_back(R); }
@@ -147,10 +173,12 @@ namespace {
// Do not push back duplicates.
if (!S.count(V)) { Q.push_back(V); S.insert(V); }
}
+
Value *pop_front_val() {
Value *V = Q.front(); Q.pop_front(); S.erase(V);
return V;
}
+
bool empty() const { return Q.empty(); }
private:
@@ -158,12 +186,13 @@ namespace {
std::set<Value*> S;
};
- typedef std::set<Value*> ValueSetType;
+ using ValueSetType = std::set<Value *>;
+
std::vector<Rule> Rules;
public:
struct Context {
- typedef DenseMap<Value*,Value*> ValueMapType;
+ using ValueMapType = DenseMap<Value *, Value *>;
Value *Root;
ValueSetType Used; // The set of all cloned values used by Root.
@@ -174,12 +203,15 @@ namespace {
: Ctx(Exp->getParent()->getParent()->getContext()) {
initialize(Exp);
}
+
~Context() { cleanup(); }
- void print(raw_ostream &OS, const Value *V) const;
+ void print(raw_ostream &OS, const Value *V) const;
Value *materialize(BasicBlock *B, BasicBlock::iterator At);
private:
+ friend struct Simplifier;
+
void initialize(Instruction *Exp);
void cleanup();
@@ -193,8 +225,6 @@ namespace {
Value *subst(Value *Tree, Value *OldV, Value *NewV);
void replace(Value *OldV, Value *NewV);
void link(Instruction *I, BasicBlock *B, BasicBlock::iterator At);
-
- friend struct Simplifier;
};
Value *simplify(Context &C);
@@ -202,6 +232,7 @@ namespace {
struct PE {
PE(const Simplifier::Context &c, Value *v = nullptr) : C(c), V(v) {}
+
const Simplifier::Context &C;
const Value *V;
};
@@ -211,8 +242,22 @@ namespace {
P.C.print(OS, P.V ? P.V : P.C.Root);
return OS;
}
-}
+} // end anonymous namespace
+
+char HexagonLoopIdiomRecognize::ID = 0;
+
+INITIALIZE_PASS_BEGIN(HexagonLoopIdiomRecognize, "hexagon-loop-idiom",
+ "Recognize Hexagon-specific loop idioms", false, false)
+INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
+INITIALIZE_PASS_DEPENDENCY(LCSSAWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
+INITIALIZE_PASS_END(HexagonLoopIdiomRecognize, "hexagon-loop-idiom",
+ "Recognize Hexagon-specific loop idioms", false, false)
template <typename FuncT>
void Simplifier::Context::traverse(Value *V, FuncT F) {
@@ -230,7 +275,6 @@ void Simplifier::Context::traverse(Value *V, FuncT F) {
}
}
-
void Simplifier::Context::print(raw_ostream &OS, const Value *V) const {
const auto *U = dyn_cast<const Instruction>(V);
if (!U) {
@@ -257,7 +301,6 @@ void Simplifier::Context::print(raw_ostream &OS, const Value *V) const {
OS << ')';
}
-
void Simplifier::Context::initialize(Instruction *Exp) {
// Perform a deep clone of the expression, set Root to the root
// of the clone, and build a map from the cloned values to the
@@ -297,7 +340,6 @@ void Simplifier::Context::initialize(Instruction *Exp) {
use(Root);
}
-
void Simplifier::Context::record(Value *V) {
auto Record = [this](Instruction *U) -> bool {
Clones.insert(U);
@@ -306,7 +348,6 @@ void Simplifier::Context::record(Value *V) {
traverse(V, Record);
}
-
void Simplifier::Context::use(Value *V) {
auto Use = [this](Instruction *U) -> bool {
Used.insert(U);
@@ -315,7 +356,6 @@ void Simplifier::Context::use(Value *V) {
traverse(V, Use);
}
-
void Simplifier::Context::unuse(Value *V) {
if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != nullptr)
return;
@@ -329,7 +369,6 @@ void Simplifier::Context::unuse(Value *V) {
traverse(V, Unuse);
}
-
Value *Simplifier::Context::subst(Value *Tree, Value *OldV, Value *NewV) {
if (Tree == OldV)
return NewV;
@@ -356,7 +395,6 @@ Value *Simplifier::Context::subst(Value *Tree, Value *OldV, Value *NewV) {
return Tree;
}
-
void Simplifier::Context::replace(Value *OldV, Value *NewV) {
if (Root == OldV) {
Root = NewV;
@@ -391,7 +429,6 @@ void Simplifier::Context::replace(Value *OldV, Value *NewV) {
use(Root);
}
-
void Simplifier::Context::cleanup() {
for (Value *V : Clones) {
Instruction *U = cast<Instruction>(V);
@@ -406,7 +443,6 @@ void Simplifier::Context::cleanup() {
}
}
-
bool Simplifier::Context::equal(const Instruction *I,
const Instruction *J) const {
if (I == J)
@@ -431,7 +467,6 @@ bool Simplifier::Context::equal(const Instruction *I,
return true;
}
-
Value *Simplifier::Context::find(Value *Tree, Value *Sub) const {
Instruction *SubI = dyn_cast<Instruction>(Sub);
WorkListType Q;
@@ -453,7 +488,6 @@ Value *Simplifier::Context::find(Value *Tree, Value *Sub) const {
return nullptr;
}
-
void Simplifier::Context::link(Instruction *I, BasicBlock *B,
BasicBlock::iterator At) {
if (I->getParent())
@@ -467,7 +501,6 @@ void Simplifier::Context::link(Instruction *I, BasicBlock *B,
B->getInstList().insert(At, I);
}
-
Value *Simplifier::Context::materialize(BasicBlock *B,
BasicBlock::iterator At) {
if (Instruction *RootI = dyn_cast<Instruction>(Root))
@@ -475,7 +508,6 @@ Value *Simplifier::Context::materialize(BasicBlock *B,
return Root;
}
-
Value *Simplifier::simplify(Context &C) {
WorkListType Q;
Q.push_back(C.Root);
@@ -507,7 +539,6 @@ Value *Simplifier::simplify(Context &C) {
return Count < Limit ? C.Root : nullptr;
}
-
//===----------------------------------------------------------------------===//
//
// Implementation of PolynomialMultiplyRecognize
@@ -515,6 +546,7 @@ Value *Simplifier::simplify(Context &C) {
//===----------------------------------------------------------------------===//
namespace {
+
class PolynomialMultiplyRecognize {
public:
explicit PolynomialMultiplyRecognize(Loop *loop, const DataLayout &dl,
@@ -523,13 +555,15 @@ namespace {
: CurLoop(loop), DL(dl), DT(dt), TLI(tli), SE(se) {}
bool recognize();
+
private:
- typedef SetVector<Value*> ValueSeq;
+ using ValueSeq = SetVector<Value *>;
IntegerType *getPmpyType() const {
LLVMContext &Ctx = CurLoop->getHeader()->getParent()->getContext();
return IntegerType::get(Ctx, 32);
}
+
bool isPromotableTo(Value *V, IntegerType *Ty);
void promoteTo(Instruction *In, IntegerType *DestTy, BasicBlock *LoopB);
bool promoteTypes(BasicBlock *LoopB, BasicBlock *ExitB);
@@ -548,12 +582,17 @@ namespace {
void cleanupLoopBody(BasicBlock *LoopB);
struct ParsedValues {
- ParsedValues() : M(nullptr), P(nullptr), Q(nullptr), R(nullptr),
- X(nullptr), Res(nullptr), IterCount(0), Left(false), Inv(false) {}
- Value *M, *P, *Q, *R, *X;
- Instruction *Res;
- unsigned IterCount;
- bool Left, Inv;
+ ParsedValues() = default;
+
+ Value *M = nullptr;
+ Value *P = nullptr;
+ Value *Q = nullptr;
+ Value *R = nullptr;
+ Value *X = nullptr;
+ Instruction *Res = nullptr;
+ unsigned IterCount = 0;
+ bool Left = false;
+ bool Inv = false;
};
bool matchLeftShift(SelectInst *SelI, Value *CIV, ParsedValues &PV);
@@ -572,8 +611,8 @@ namespace {
const TargetLibraryInfo &TLI;
ScalarEvolution &SE;
};
-}
+} // end anonymous namespace
Value *PolynomialMultiplyRecognize::getCountIV(BasicBlock *BB) {
pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
@@ -607,7 +646,6 @@ Value *PolynomialMultiplyRecognize::getCountIV(BasicBlock *BB) {
return nullptr;
}
-
static void replaceAllUsesOfWithIn(Value *I, Value *J, BasicBlock *BB) {
for (auto UI = I->user_begin(), UE = I->user_end(); UI != UE;) {
Use &TheUse = UI.getUse();
@@ -618,7 +656,6 @@ static void replaceAllUsesOfWithIn(Value *I, Value *J, BasicBlock *BB) {
}
}
-
bool PolynomialMultiplyRecognize::matchLeftShift(SelectInst *SelI,
Value *CIV, ParsedValues &PV) {
// Match the following:
@@ -734,7 +771,6 @@ bool PolynomialMultiplyRecognize::matchLeftShift(SelectInst *SelI,
return true;
}
-
bool PolynomialMultiplyRecognize::matchRightShift(SelectInst *SelI,
ParsedValues &PV) {
// Match the following:
@@ -810,11 +846,11 @@ bool PolynomialMultiplyRecognize::matchRightShift(SelectInst *SelI,
return true;
}
-
bool PolynomialMultiplyRecognize::scanSelect(SelectInst *SelI,
BasicBlock *LoopB, BasicBlock *PrehB, Value *CIV, ParsedValues &PV,
bool PreScan) {
using namespace PatternMatch;
+
// The basic pattern for R = P.Q is:
// for i = 0..31
// R = phi (0, R')
@@ -917,7 +953,6 @@ bool PolynomialMultiplyRecognize::scanSelect(SelectInst *SelI,
return false;
}
-
bool PolynomialMultiplyRecognize::isPromotableTo(Value *Val,
IntegerType *DestTy) {
IntegerType *T = dyn_cast<IntegerType>(Val->getType());
@@ -955,7 +990,6 @@ bool PolynomialMultiplyRecognize::isPromotableTo(Value *Val,
return false;
}
-
void PolynomialMultiplyRecognize::promoteTo(Instruction *In,
IntegerType *DestTy, BasicBlock *LoopB) {
// Leave boolean values alone.
@@ -997,7 +1031,6 @@ void PolynomialMultiplyRecognize::promoteTo(Instruction *In,
}
}
-
bool PolynomialMultiplyRecognize::promoteTypes(BasicBlock *LoopB,
BasicBlock *ExitB) {
assert(LoopB);
@@ -1061,7 +1094,6 @@ bool PolynomialMultiplyRecognize::promoteTypes(BasicBlock *LoopB,
return true;
}
-
bool PolynomialMultiplyRecognize::findCycle(Value *Out, Value *In,
ValueSeq &Cycle) {
// Out = ..., In, ...
@@ -1094,7 +1126,6 @@ bool PolynomialMultiplyRecognize::findCycle(Value *Out, Value *In,
return !Cycle.empty();
}
-
void PolynomialMultiplyRecognize::classifyCycle(Instruction *DivI,
ValueSeq &Cycle, ValueSeq &Early, ValueSeq &Late) {
// All the values in the cycle that are between the phi node and the
@@ -1131,7 +1162,6 @@ void PolynomialMultiplyRecognize::classifyCycle(Instruction *DivI,
First.insert(Cycle[I]);
}
-
bool PolynomialMultiplyRecognize::classifyInst(Instruction *UseI,
ValueSeq &Early, ValueSeq &Late) {
// Select is an exception, since the condition value does not have to be
@@ -1184,7 +1214,6 @@ bool PolynomialMultiplyRecognize::classifyInst(Instruction *UseI,
return true;
}
-
bool PolynomialMultiplyRecognize::commutesWithShift(Instruction *I) {
switch (I->getOpcode()) {
case Instruction::And:
@@ -1202,7 +1231,6 @@ bool PolynomialMultiplyRecognize::commutesWithShift(Instruction *I) {
return true;
}
-
bool PolynomialMultiplyRecognize::highBitsAreZero(Value *V,
unsigned IterCount) {
auto *T = dyn_cast<IntegerType>(V->getType());
@@ -1214,7 +1242,6 @@ bool PolynomialMultiplyRecognize::highBitsAreZero(Value *V,
return Known.countMinLeadingZeros() >= IterCount;
}
-
bool PolynomialMultiplyRecognize::keepsHighBitsZero(Value *V,
unsigned IterCount) {
// Assume that all inputs to the value have the high bits zero.
@@ -1239,7 +1266,6 @@ bool PolynomialMultiplyRecognize::keepsHighBitsZero(Value *V,
return false;
}
-
bool PolynomialMultiplyRecognize::isOperandShifted(Instruction *I, Value *Op) {
unsigned Opc = I->getOpcode();
if (Opc == Instruction::Shl || Opc == Instruction::LShr)
@@ -1247,7 +1273,6 @@ bool PolynomialMultiplyRecognize::isOperandShifted(Instruction *I, Value *Op) {
return true;
}
-
bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
BasicBlock *ExitB, unsigned IterCount) {
Value *CIV = getCountIV(LoopB);
@@ -1263,6 +1288,7 @@ bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
// Find all value cycles that contain logical right shifts by 1.
for (Instruction &I : *LoopB) {
using namespace PatternMatch;
+
Value *V = nullptr;
if (!match(&I, m_LShr(m_Value(V), m_One())))
continue;
@@ -1303,7 +1329,7 @@ bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
}
}
- if (Users.size() == 0)
+ if (Users.empty())
return false;
// Verify that high bits remain zero.
@@ -1331,7 +1357,9 @@ bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
// Finally, the work can be done. Unshift each user.
IRBuilder<> IRB(LoopB);
std::map<Value*,Value*> ShiftMap;
- typedef std::map<std::pair<Value*,Type*>,Value*> CastMapType;
+
+ using CastMapType = std::map<std::pair<Value *, Type *>, Value *>;
+
CastMapType CastMap;
auto upcast = [] (CastMapType &CM, IRBuilder<> &IRB, Value *V,
@@ -1345,9 +1373,11 @@ bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
};
for (auto I = LoopB->begin(), E = LoopB->end(); I != E; ++I) {
+ using namespace PatternMatch;
+
if (isa<PHINode>(I) || !Users.count(&*I))
continue;
- using namespace PatternMatch;
+
// Match lshr x, 1.
Value *V = nullptr;
if (match(&*I, m_LShr(m_Value(V), m_One()))) {
@@ -1419,7 +1449,6 @@ bool PolynomialMultiplyRecognize::convertShiftsToLeft(BasicBlock *LoopB,
return true;
}
-
void PolynomialMultiplyRecognize::cleanupLoopBody(BasicBlock *LoopB) {
for (auto &I : *LoopB)
if (Value *SV = SimplifyInstruction(&I, {DL, &TLI, &DT}))
@@ -1431,7 +1460,6 @@ void PolynomialMultiplyRecognize::cleanupLoopBody(BasicBlock *LoopB) {
}
}
-
unsigned PolynomialMultiplyRecognize::getInverseMxN(unsigned QP) {
// Arrays of coefficients of Q and the inverse, C.
// Q[i] = coefficient at x^i.
@@ -1475,7 +1503,6 @@ unsigned PolynomialMultiplyRecognize::getInverseMxN(unsigned QP) {
return QV;
}
-
Value *PolynomialMultiplyRecognize::generate(BasicBlock::iterator At,
ParsedValues &PV) {
IRBuilder<> B(&*At);
@@ -1517,7 +1544,6 @@ Value *PolynomialMultiplyRecognize::generate(BasicBlock::iterator At,
return R;
}
-
void PolynomialMultiplyRecognize::setupSimplifier() {
Simp.addRule(
// Sink zext past bitwise operations.
@@ -1670,7 +1696,6 @@ void PolynomialMultiplyRecognize::setupSimplifier() {
});
}
-
bool PolynomialMultiplyRecognize::recognize() {
DEBUG(dbgs() << "Starting PolynomialMultiplyRecognize on loop\n"
<< *CurLoop << '\n');
@@ -1789,7 +1814,6 @@ bool PolynomialMultiplyRecognize::recognize() {
return true;
}
-
unsigned HexagonLoopIdiomRecognize::getStoreSizeInBytes(StoreInst *SI) {
uint64_t SizeInBits = DL->getTypeSizeInBits(SI->getValueOperand()->getType());
assert(((SizeInBits & 7) || (SizeInBits >> 32) == 0) &&
@@ -1797,14 +1821,12 @@ unsigned HexagonLoopIdiomRecognize::getStoreSizeInBytes(StoreInst *SI) {
return (unsigned)SizeInBits >> 3;
}
-
int HexagonLoopIdiomRecognize::getSCEVStride(const SCEVAddRecExpr *S) {
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(1)))
return SC->getAPInt().getSExtValue();
return 0;
}
-
bool HexagonLoopIdiomRecognize::isLegalStore(Loop *CurLoop, StoreInst *SI) {
// Allow volatile stores if HexagonVolatileMemcpy is enabled.
if (!(SI->isVolatile() && HexagonVolatileMemcpy) && !SI->isSimple())
@@ -1855,7 +1877,6 @@ bool HexagonLoopIdiomRecognize::isLegalStore(Loop *CurLoop, StoreInst *SI) {
return true;
}
-
/// mayLoopAccessLocation - Return true if the specified loop might access the
/// specified pointer location, which is a loop-strided access. The 'Access'
/// argument specifies what the verboten forms of access are (read or write).
@@ -1888,7 +1909,6 @@ mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L,
return false;
}
-
void HexagonLoopIdiomRecognize::collectStores(Loop *CurLoop, BasicBlock *BB,
SmallVectorImpl<StoreInst*> &Stores) {
Stores.clear();
@@ -1898,7 +1918,6 @@ void HexagonLoopIdiomRecognize::collectStores(Loop *CurLoop, BasicBlock *BB,
Stores.push_back(SI);
}
-
bool HexagonLoopIdiomRecognize::processCopyingStore(Loop *CurLoop,
StoreInst *SI, const SCEV *BECount) {
assert((SI->isSimple() || (SI->isVolatile() && HexagonVolatileMemcpy)) &&
@@ -1998,7 +2017,7 @@ CleanupAndExit:
if (DisableMemmoveIdiom || !HasMemmove)
goto CleanupAndExit;
- bool IsNested = CurLoop->getParentLoop() != 0;
+ bool IsNested = CurLoop->getParentLoop() != nullptr;
if (IsNested && OnlyNonNestedMemmove)
goto CleanupAndExit;
}
@@ -2191,7 +2210,6 @@ CleanupAndExit:
return true;
}
-
// \brief Check if the instructions in Insts, together with their dependencies
// cover the loop in the sense that the loop could be safely eliminated once
// the instructions in Insts are removed.
@@ -2270,7 +2288,6 @@ bool HexagonLoopIdiomRecognize::runOnLoopBlock(Loop *CurLoop, BasicBlock *BB,
return MadeChange;
}
-
bool HexagonLoopIdiomRecognize::runOnCountableLoop(Loop *L) {
PolynomialMultiplyRecognize PMR(L, *DL, *DT, *TLI, *SE);
if (PMR.recognize())
@@ -2300,7 +2317,6 @@ bool HexagonLoopIdiomRecognize::runOnCountableLoop(Loop *L) {
return Changed;
}
-
bool HexagonLoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
const Module &M = *L->getHeader()->getParent()->getParent();
if (Triple(M.getTargetTriple()).getArch() != Triple::hexagon)
@@ -2334,8 +2350,6 @@ bool HexagonLoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
return false;
}
-
Pass *llvm::createHexagonLoopIdiomPass() {
return new HexagonLoopIdiomRecognize();
}
-