llvm.org GIT mirror llvm / a27e16e
Give helper classes/functions internal linkage. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275014 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 4 years ago
7 changed file(s) with 26 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
27302730
27312731 // Check if the condition of the select has one use or two users that are both
27322732 // selects with the same condition.
2733 bool hasOnlySelectUsers(const Value *Cond) {
2733 static bool hasOnlySelectUsers(const Value *Cond) {
27342734 return std::all_of(Cond->user_begin(), Cond->user_end(), [](const Value *V) {
27352735 return isa(V);
27362736 });
7979 };
8080
8181 template
82 Error loadSectionContribs(FixedStreamArray &Output,
83 StreamReader &Reader) {
82 static Error loadSectionContribs(FixedStreamArray &Output,
83 StreamReader &Reader) {
8484 if (Reader.bytesRemaining() % sizeof(ContribType) != 0)
8585 return make_error(
8686 raw_error_code::corrupt_file,
37193719 }
37203720 }
37213721
3722 bool isGTorGE(ISD::CondCode CC) { return CC == ISD::SETGT || CC == ISD::SETGE; }
3723
3724 bool isLTorLE(ISD::CondCode CC) { return CC == ISD::SETLT || CC == ISD::SETLE; }
3722 static bool isGTorGE(ISD::CondCode CC) {
3723 return CC == ISD::SETGT || CC == ISD::SETGE;
3724 }
3725
3726 static bool isLTorLE(ISD::CondCode CC) {
3727 return CC == ISD::SETLT || CC == ISD::SETLE;
3728 }
37253729
37263730 // See if a conditional (LHS CC RHS ? TrueVal : FalseVal) is lower-saturating.
37273731 // All of these conditions (and their <= and >= counterparts) will do:
37293733 // x > k ? x : k
37303734 // k < x ? x : k
37313735 // k > x ? k : x
3732 bool isLowerSaturate(const SDValue LHS, const SDValue RHS,
3733 const SDValue TrueVal, const SDValue FalseVal,
3734 const ISD::CondCode CC, const SDValue K) {
3736 static bool isLowerSaturate(const SDValue LHS, const SDValue RHS,
3737 const SDValue TrueVal, const SDValue FalseVal,
3738 const ISD::CondCode CC, const SDValue K) {
37353739 return (isGTorGE(CC) &&
37363740 ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal))) ||
37373741 (isLTorLE(CC) &&
37393743 }
37403744
37413745 // Similar to isLowerSaturate(), but checks for upper-saturating conditions.
3742 bool isUpperSaturate(const SDValue LHS, const SDValue RHS,
3743 const SDValue TrueVal, const SDValue FalseVal,
3744 const ISD::CondCode CC, const SDValue K) {
3746 static bool isUpperSaturate(const SDValue LHS, const SDValue RHS,
3747 const SDValue TrueVal, const SDValue FalseVal,
3748 const ISD::CondCode CC, const SDValue K) {
37453749 return (isGTorGE(CC) &&
37463750 ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal))) ||
37473751 (isLTorLE(CC) &&
37613765 //
37623766 // It returns true if the conversion can be done, false otherwise.
37633767 // Additionally, the variable is returned in parameter V and the constant in K.
3764 bool isSaturatingConditional(const SDValue &Op, SDValue &V, uint64_t &K) {
3768 static bool isSaturatingConditional(const SDValue &Op, SDValue &V,
3769 uint64_t &K) {
37653770
37663771 SDValue LHS1 = Op.getOperand(0);
37673772 SDValue RHS1 = Op.getOperand(1);
10491049 return PA;
10501050 }
10511051
1052 namespace {
10521053 /// A legacy pass for the legacy pass manager that wraps \c DSEPass.
10531054 class DSELegacyPass : public FunctionPass {
10541055 public:
10831084
10841085 static char ID; // Pass identification, replacement for typeid
10851086 };
1087 } // end anonymous namespace
10861088
10871089 char DSELegacyPass::ID = 0;
10881090 INITIALIZE_PASS_BEGIN(DSELegacyPass, "dse", "Dead Store Elimination", false,
4848
4949 STATISTIC(NumRotated, "Number of loops rotated");
5050
51 namespace {
5152 /// A simple loop rotation transformation.
5253 class LoopRotate {
5354 const unsigned MaxHeaderSize;
6970 bool rotateLoop(Loop *L, bool SimplifiedLatch);
7071 bool simplifyLoopLatch(Loop *L);
7172 };
73 } // end anonymous namespace
7274
7375 /// RewriteUsesOfClonedInstructions - We just cloned the instructions from the
7476 /// old header into the preheader. If there were uses of the values produced by
9292
9393 #define DEBUG_TYPE "mldst-motion"
9494
95 namespace {
9596 //===----------------------------------------------------------------------===//
9697 // MergedLoadStoreMotion Pass
9798 //===----------------------------------------------------------------------===//
134135 bool sinkStore(BasicBlock *BB, StoreInst *SinkCand, StoreInst *ElseInst);
135136 bool mergeStores(BasicBlock *BB);
136137 };
138 } // end anonymous namespace
137139
138140 ///
139141 /// \brief Remove instruction from parent and update memory dependence analysis.
34253425 MinBWs[Scalar] = MaxBitWidth;
34263426 }
34273427
3428 namespace {
34283429 /// The SLPVectorizer Pass.
34293430 struct SLPVectorizer : public FunctionPass {
34303431 SLPVectorizerPass Impl;
34743475 AU.setPreservesCFG();
34753476 }
34763477 };
3478 } // end anonymous namespace
34773479
34783480 PreservedAnalyses SLPVectorizerPass::run(Function &F, FunctionAnalysisManager &AM) {
34793481 auto *SE = &AM.getResult(F);