Lines Matching full:unroll
42 #define DEBUG_TYPE "loop-unroll"
45 UnrollThreshold("unroll-threshold", cl::Hidden,
49 "unroll-percent-dynamic-cost-saved-threshold", cl::init(50), cl::Hidden,
54 "unroll-dynamic-cost-savings-discount", cl::init(100), cl::Hidden,
55 cl::desc("This is the amount discounted from the total unroll cost when "
57 "the '-unroll-perecent-dynamic-cost-saved-threshold' flag)."));
60 "unroll-max-iteration-count-to-analyze", cl::init(10), cl::Hidden,
62 "iterations when checking full unroll profitability"));
65 "unroll-count", cl::Hidden,
66 cl::desc("Use this unroll count for all loops including those with "
70 "unroll-max-count", cl::Hidden,
71 cl::desc("Set the max unroll count for partial and runtime unrolling, for"
75 "unroll-full-max-count", cl::Hidden,
77 "Set the max unroll count for full unrolling, for testing purposes"));
80 UnrollAllowPartial("unroll-allow-partial", cl::Hidden,
82 "-unroll-threshold loop size is reached."));
85 "unroll-allow-remainder", cl::Hidden,
90 UnrollRuntime("unroll-runtime", cl::ZeroOrMore, cl::Hidden,
91 cl::desc("Unroll loops with run-time trip counts"));
94 "pragma-unroll-threshold", cl::init(16 * 1024), cl::Hidden,
95 cl::desc("Unrolled size limit for loops with an unroll(full) or "
99 /// that the loop unroll should be performed regardless of how much
103 /// Default unroll count for loops with run-time trip count if
104 /// -unroll-count is not set
242 "The unroll iterations max is too large!");
557 // "llvm.loop.unroll.count"). If no such metadata node exists, then nullptr is
565 // Returns true if the loop has an unroll(full) pragma.
567 return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.full");
570 // Returns true if the loop has an unroll(enable) pragma. This metadata is used
571 // for both "#pragma unroll" and "#pragma clang loop unroll(enable)" directives.
573 return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.enable");
576 // Returns true if the loop has an unroll(disable) pragma.
578 return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.disable");
581 // Returns true if the loop has an runtime unroll(disable) pragma.
583 return GetUnrollMetadataForLoop(L, "llvm.loop.unroll.runtime.disable");
589 MDNode *MD = GetUnrollMetadataForLoop(L, "llvm.loop.unroll.count");
592 "Unroll count hint metadata should have two operands.");
595 assert(Count >= 1 && "Unroll count must be positive.");
601 // Remove existing unroll metadata and add unroll disable metadata to
618 IsUnrollMetadata = S && S->getString().startswith("llvm.loop.unroll.");
625 // Add unroll(disable) metadata to disable future unrolling.
628 DisableOperands.push_back(MDString::get(Context, "llvm.loop.unroll.disable"));
644 DEBUG(dbgs() << " Can fully unroll, because no threshold is set.\n");
649 DEBUG(dbgs() << " Can fully unroll, because unrolled cost: "
668 DEBUG(dbgs() << " Can fully unroll, because unrolling will reduce the "
678 DEBUG(dbgs() << " Too large to fully unroll:\n");
690 // Returns true if unroll count was set explicitly.
691 // Calculates unroll count and writes it to UP.Count.
703 // 1st priority is unroll count set by "unroll-count" option.
714 // 2nd priority is unroll count set by pragma.
750 // 3rd priority is full unroll count.
751 // Full unroll make sense only when TripCount could be staticaly calculated.
762 // The loop isn't that small, but we still can fully unroll it if that
779 // Try partial unroll only when TripCount could be staticaly calculated.
785 DEBUG(dbgs() << " will not try to unroll partially because "
786 << "-unroll-allow-partial not given\n");
791 // Reduce unroll count to be modulo of TripCount for partial unrolling.
816 "Unable to unroll loop as directed by unroll(enable) pragma "
827 "Unable to fully unroll loop as directed by unroll pragma because "
836 "Unable to fully unroll loop as directed by unroll(full) pragma "
840 // Don't unroll a runtime trip count loop when it is disabled.
848 DEBUG(dbgs() << " will not try to unroll loop with runtime trip count "
849 << "-unroll-runtime not given\n");
857 // Reduce unroll count to be the largest power-of-two factor of
873 "instruction), so unroll count must divide the trip "
875 << TripMultiple << ". Reducing unroll count from "
880 Twine("Unable to unroll loop the number of times directed by "
883 "contains a convergent instruction) and so must have an unroll "
904 DEBUG(dbgs() << "Loop Unroll: F[" << L->getHeader()->getParent()->getName()
968 // Unroll factor (Count) must be less or equal to TripCount.
972 // Unroll the loop.
978 // If loop has an unroll count pragma or unrolled by explicitly set count
1036 INITIALIZE_PASS_BEGIN(LoopUnroll, "loop-unroll", "Unroll loops", false, false)
1040 INITIALIZE_PASS_END(LoopUnroll, "loop-unroll", "Unroll loops", false, false)