14#include "llvm/IR/BasicBlock.h"
15#include "llvm/IR/CFG.h"
16#include "llvm/IR/Constants.h"
17#include "llvm/IR/InstrTypes.h"
18#include "llvm/IR/Instructions.h"
19#include "llvm/IR/Metadata.h"
25LoopInfo::createFollowupMetadata(
const char *FollowupName,
27 LLVMContext &Ctx = Header->getContext();
29 SmallVector<Metadata *, 4> Args;
30 Args.push_back(MDString::get(Ctx, FollowupName));
31 Args.append(LoopProperties.begin(), LoopProperties.end());
32 return MDNode::get(Ctx, Args);
35SmallVector<Metadata *, 4>
37 ArrayRef<Metadata *> LoopProperties,
38 bool &HasUserTransforms) {
39 LLVMContext &Ctx = Header->getContext();
41 std::optional<bool> Enabled;
42 if (Attrs.PipelineDisabled)
44 else if (Attrs.PipelineInitiationInterval != 0)
47 SmallVector<Metadata *, 4> Args;
48 Args.append(LoopProperties.begin(), LoopProperties.end());
50 if (Enabled !=
true) {
51 if (Enabled ==
false) {
53 MDNode::get(Ctx, {MDString::get(Ctx,
"llvm.loop.pipeline.disable"),
54 ConstantAsMetadata::get(ConstantInt::get(
55 llvm::Type::getInt1Ty(Ctx), 1))}));
60 if (Attrs.PipelineInitiationInterval > 0) {
62 MDString::get(Ctx,
"llvm.loop.pipeline.initiationinterval"),
63 ConstantAsMetadata::get(ConstantInt::get(
64 llvm::Type::getInt32Ty(Ctx), Attrs.PipelineInitiationInterval))};
65 Args.push_back(MDNode::get(Ctx, Vals));
70 HasUserTransforms =
true;
74SmallVector<Metadata *, 4>
76 ArrayRef<Metadata *> LoopProperties,
77 bool &HasUserTransforms) {
78 LLVMContext &Ctx = Header->getContext();
80 std::optional<bool> Enabled;
84 Enabled = std::nullopt;
86 Attrs.UnrollCount != 0)
89 if (Enabled !=
true) {
92 return createPipeliningMetadata(Attrs, LoopProperties, HasUserTransforms);
95 SmallVector<Metadata *, 4> FollowupLoopProperties;
98 FollowupLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
101 FollowupLoopProperties.push_back(
102 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.unroll.disable")));
104 bool FollowupHasTransforms =
false;
105 SmallVector<Metadata *, 4> Followup = createPipeliningMetadata(
106 Attrs, FollowupLoopProperties, FollowupHasTransforms);
108 SmallVector<Metadata *, 4> Args;
109 Args.append(LoopProperties.begin(), LoopProperties.end());
112 if (Attrs.UnrollCount > 0) {
113 Metadata *Vals[] = {MDString::get(Ctx,
"llvm.loop.unroll.count"),
114 ConstantAsMetadata::get(ConstantInt::get(
115 llvm::Type::getInt32Ty(Ctx), Attrs.UnrollCount))};
116 Args.push_back(MDNode::get(Ctx, Vals));
121 Metadata *Vals[] = {MDString::get(Ctx,
"llvm.loop.unroll.enable")};
122 Args.push_back(MDNode::get(Ctx, Vals));
125 if (FollowupHasTransforms)
127 createFollowupMetadata(
"llvm.loop.unroll.followup_all", Followup));
129 HasUserTransforms =
true;
133SmallVector<Metadata *, 4>
135 ArrayRef<Metadata *> LoopProperties,
136 bool &HasUserTransforms) {
137 LLVMContext &Ctx = Header->getContext();
139 std::optional<bool> Enabled;
143 Attrs.UnrollAndJamCount != 0)
146 if (Enabled !=
true) {
147 SmallVector<Metadata *, 4> NewLoopProperties;
148 if (Enabled ==
false) {
149 NewLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
150 NewLoopProperties.push_back(MDNode::get(
151 Ctx, MDString::get(Ctx,
"llvm.loop.unroll_and_jam.disable")));
152 LoopProperties = NewLoopProperties;
154 return createPartialUnrollMetadata(Attrs, LoopProperties,
158 SmallVector<Metadata *, 4> FollowupLoopProperties;
159 FollowupLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
160 FollowupLoopProperties.push_back(
161 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.unroll_and_jam.disable")));
163 bool FollowupHasTransforms =
false;
164 SmallVector<Metadata *, 4> Followup = createPartialUnrollMetadata(
165 Attrs, FollowupLoopProperties, FollowupHasTransforms);
167 SmallVector<Metadata *, 4> Args;
168 Args.append(LoopProperties.begin(), LoopProperties.end());
171 if (Attrs.UnrollAndJamCount > 0) {
173 MDString::get(Ctx,
"llvm.loop.unroll_and_jam.count"),
174 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),
175 Attrs.UnrollAndJamCount))};
176 Args.push_back(MDNode::get(Ctx, Vals));
180 Metadata *Vals[] = {MDString::get(Ctx,
"llvm.loop.unroll_and_jam.enable")};
181 Args.push_back(MDNode::get(Ctx, Vals));
184 if (FollowupHasTransforms)
185 Args.push_back(createFollowupMetadata(
186 "llvm.loop.unroll_and_jam.followup_outer", Followup));
188 if (UnrollAndJamInnerFollowup.has_value())
189 Args.push_back(createFollowupMetadata(
190 "llvm.loop.unroll_and_jam.followup_inner", *UnrollAndJamInnerFollowup));
192 HasUserTransforms =
true;
196SmallVector<Metadata *, 4>
198 ArrayRef<Metadata *> LoopProperties,
199 bool &HasUserTransforms) {
200 LLVMContext &Ctx = Header->getContext();
202 std::optional<bool> Enabled;
207 Attrs.InterleaveCount != 0 || Attrs.VectorizeWidth != 0 ||
211 if (Enabled !=
true) {
212 SmallVector<Metadata *, 4> NewLoopProperties;
213 if (Enabled ==
false) {
214 NewLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
215 NewLoopProperties.push_back(
216 MDNode::get(Ctx, {MDString::get(Ctx,
"llvm.loop.vectorize.enable"),
217 ConstantAsMetadata::get(ConstantInt::get(
218 llvm::Type::getInt1Ty(Ctx), 0))}));
219 LoopProperties = NewLoopProperties;
221 return createUnrollAndJamMetadata(Attrs, LoopProperties, HasUserTransforms);
224 SmallVector<Metadata *, 4> Args;
225 Args.append(LoopProperties.begin(), LoopProperties.end());
229 bool IsVectorPredicateEnabled =
false;
231 IsVectorPredicateEnabled =
235 MDString::get(Ctx,
"llvm.loop.vectorize.predicate.enable"),
236 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt1Ty(Ctx),
237 IsVectorPredicateEnabled))};
238 Args.push_back(MDNode::get(Ctx, Vals));
242 if (Attrs.VectorizeWidth > 0) {
244 MDString::get(Ctx,
"llvm.loop.vectorize.width"),
245 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),
246 Attrs.VectorizeWidth))};
248 Args.push_back(MDNode::get(Ctx, Vals));
254 MDString::get(Ctx,
"llvm.loop.vectorize.scalable.enable"),
255 ConstantAsMetadata::get(
256 ConstantInt::get(llvm::Type::getInt1Ty(Ctx), IsScalable))};
257 Args.push_back(MDNode::get(Ctx, Vals));
261 if (Attrs.InterleaveCount > 0) {
263 MDString::get(Ctx,
"llvm.loop.interleave.count"),
264 ConstantAsMetadata::get(ConstantInt::get(llvm::Type::getInt32Ty(Ctx),
265 Attrs.InterleaveCount))};
266 Args.push_back(MDNode::get(Ctx, Vals));
277 bool VectorizeEnabled =
false;
279 (IsVectorPredicateEnabled && Attrs.VectorizeWidth != 1) ||
280 Attrs.VectorizeWidth > 1 ||
283 Attrs.VectorizeWidth != 1)) {
286 MDNode::get(Ctx, {MDString::get(Ctx,
"llvm.loop.vectorize.enable"),
287 ConstantAsMetadata::get(ConstantInt::get(
288 llvm::Type::getInt1Ty(Ctx), VectorizeEnabled))}));
292 SmallVector<Metadata *, 4> FollowupLoopProperties;
297 if (VectorizeEnabled)
298 FollowupLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
301 FollowupLoopProperties.push_back(
302 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.isvectorized")));
304 bool FollowupHasTransforms =
false;
305 SmallVector<Metadata *, 4> Followup = createUnrollAndJamMetadata(
306 Attrs, FollowupLoopProperties, FollowupHasTransforms);
308 if (FollowupHasTransforms) {
311 if (VectorizeEnabled)
313 createFollowupMetadata(
"llvm.loop.vectorize.followup_all", Followup));
315 Args.append(Followup.begin(), Followup.end());
318 HasUserTransforms =
true;
322SmallVector<Metadata *, 4>
323LoopInfo::createLoopDistributeMetadata(
const LoopAttributes &Attrs,
324 ArrayRef<Metadata *> LoopProperties,
325 bool &HasUserTransforms) {
326 LLVMContext &Ctx = Header->getContext();
328 std::optional<bool> Enabled;
334 if (Enabled !=
true) {
335 SmallVector<Metadata *, 4> NewLoopProperties;
336 if (Enabled ==
false) {
337 NewLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
338 NewLoopProperties.push_back(
339 MDNode::get(Ctx, {MDString::get(Ctx,
"llvm.loop.distribute.enable"),
340 ConstantAsMetadata::get(ConstantInt::get(
341 llvm::Type::getInt1Ty(Ctx), 0))}));
342 LoopProperties = NewLoopProperties;
344 return createLoopVectorizeMetadata(Attrs, LoopProperties,
348 bool FollowupHasTransforms =
false;
349 SmallVector<Metadata *, 4> Followup =
350 createLoopVectorizeMetadata(Attrs, LoopProperties, FollowupHasTransforms);
352 SmallVector<Metadata *, 4> Args;
353 Args.append(LoopProperties.begin(), LoopProperties.end());
355 Metadata *Vals[] = {MDString::get(Ctx,
"llvm.loop.distribute.enable"),
356 ConstantAsMetadata::get(ConstantInt::get(
357 llvm::Type::getInt1Ty(Ctx),
359 Args.push_back(MDNode::get(Ctx, Vals));
361 if (FollowupHasTransforms)
363 createFollowupMetadata(
"llvm.loop.distribute.followup_all", Followup));
365 HasUserTransforms =
true;
369SmallVector<Metadata *, 4>
371 ArrayRef<Metadata *> LoopProperties,
372 bool &HasUserTransforms) {
373 LLVMContext &Ctx = Header->getContext();
375 std::optional<bool> Enabled;
381 if (Enabled !=
true) {
382 SmallVector<Metadata *, 4> NewLoopProperties;
383 if (Enabled ==
false) {
384 NewLoopProperties.append(LoopProperties.begin(), LoopProperties.end());
385 NewLoopProperties.push_back(
386 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.unroll.disable")));
387 LoopProperties = NewLoopProperties;
389 return createLoopDistributeMetadata(Attrs, LoopProperties,
393 SmallVector<Metadata *, 4> Args;
394 Args.append(LoopProperties.begin(), LoopProperties.end());
395 Args.push_back(MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.unroll.full")));
400 HasUserTransforms =
true;
404SmallVector<Metadata *, 4> LoopInfo::createMetadata(
406 llvm::ArrayRef<llvm::Metadata *> AdditionalLoopProperties,
407 bool &HasUserTransforms) {
408 SmallVector<Metadata *, 3> LoopProperties;
412 LoopProperties.push_back(StartLoc.getAsMDNode());
416 LoopProperties.push_back(EndLoc.getAsMDNode());
419 LLVMContext &Ctx = Header->getContext();
420 if (Attrs.MustProgress)
421 LoopProperties.push_back(
422 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.mustprogress")));
424 if (Attrs.LICMDisabled)
425 LoopProperties.push_back(
426 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.licm.disable")));
428 assert(!!AccGroup == Attrs.IsParallel &&
429 "There must be an access group iff the loop is parallel");
430 if (Attrs.IsParallel) {
431 LoopProperties.push_back(MDNode::get(
432 Ctx, {MDString::get(Ctx,
"llvm.loop.parallel_accesses"), AccGroup}));
436 if (Attrs.CodeAlign > 0) {
437 Metadata *Vals[] = {MDString::get(Ctx,
"llvm.loop.align"),
438 ConstantAsMetadata::get(ConstantInt::get(
439 llvm::Type::getInt32Ty(Ctx), Attrs.CodeAlign))};
440 LoopProperties.push_back(MDNode::get(Ctx, Vals));
443 llvm::append_range(LoopProperties, AdditionalLoopProperties);
444 return createFullUnrollMetadata(Attrs, LoopProperties, HasUserTransforms);
478 const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc,
480 : Header(Header), Attrs(Attrs), StartLoc(StartLoc), EndLoc(EndLoc),
483 if (Attrs.IsParallel) {
485 LLVMContext &Ctx = Header->getContext();
486 AccGroup = MDNode::getDistinct(Ctx, {});
502 TempLoopID = MDNode::getTemporary(Header->getContext(), {});
513 LLVMContext &Ctx = Header->getContext();
515 if (Parent && (Parent->Attrs.UnrollAndJamEnable ||
516 Parent->Attrs.UnrollAndJamCount != 0)) {
533 switch (Attrs.UnrollEnable) {
562 if (!Parent->UnrollAndJamInnerFollowup) {
572 BeforeLoopProperties.push_back(
573 MDNode::get(Ctx, MDString::get(Ctx,
"llvm.loop.isvectorized")));
575 bool InnerFollowupHasTransform =
false;
577 AfterJam, BeforeLoopProperties, InnerFollowupHasTransform);
578 if (InnerFollowupHasTransform)
579 Parent->UnrollAndJamInnerFollowup = InnerFollowup;
582 CurLoopAttr = BeforeJam;
585 bool HasUserTransforms =
false;
587 createMetadata(CurLoopAttr, {}, HasUserTransforms);
589 Args.push_back(
nullptr);
590 Args.append(Properties.begin(), Properties.end());
591 LoopID = MDNode::getDistinct(Ctx, Args);
592 LoopID->replaceOperandWith(0, LoopID);
594 TempLoopID->replaceAllUsesWith(LoopID);
598 const llvm::DebugLoc &EndLoc) {
600 new LoopInfo(Header, StagedAttrs, StartLoc, EndLoc,
601 Active.empty() ?
nullptr : Active.back().get()));
609 const llvm::DebugLoc &StartLoc,
610 const llvm::DebugLoc &EndLoc,
bool MustProgress) {
612 for (
const auto *
Attr : Attrs) {
613 const LoopHintAttr *LH = dyn_cast<LoopHintAttr>(
Attr);
614 const OpenCLUnrollHintAttr *OpenCLHint =
615 dyn_cast<OpenCLUnrollHintAttr>(
Attr);
616 const HLSLLoopHintAttr *HLSLLoopHint = dyn_cast<HLSLLoopHintAttr>(
Attr);
618 if (!LH && !OpenCLHint && !HLSLLoopHint) {
622 LoopHintAttr::OptionType Option = LoopHintAttr::Unroll;
623 LoopHintAttr::LoopHintState State = LoopHintAttr::Disable;
624 unsigned ValueInt = 1;
632 ValueInt = OpenCLHint->getUnrollHint();
634 State = LoopHintAttr::Enable;
635 }
else if (ValueInt != 1) {
636 Option = LoopHintAttr::UnrollCount;
637 State = LoopHintAttr::Numeric;
639 }
else if (HLSLLoopHint) {
640 ValueInt = HLSLLoopHint->getDirective();
641 if (HLSLLoopHint->getSemanticSpelling() ==
642 HLSLLoopHintAttr::Spelling::Microsoft_unroll) {
644 State = LoopHintAttr::Enable;
646 Option = LoopHintAttr::UnrollCount;
647 State = LoopHintAttr::Numeric;
651 auto *ValueExpr = LH->getValue();
653 llvm::APSInt ValueAPS = ValueExpr->EvaluateKnownConstInt(Ctx);
654 ValueInt = ValueAPS.getSExtValue();
657 Option = LH->getOption();
658 State = LH->getState();
661 case LoopHintAttr::Disable:
663 case LoopHintAttr::Vectorize:
668 case LoopHintAttr::Interleave:
672 case LoopHintAttr::Unroll:
675 case LoopHintAttr::UnrollAndJam:
678 case LoopHintAttr::VectorizePredicate:
681 case LoopHintAttr::Distribute:
684 case LoopHintAttr::PipelineDisabled:
687 case LoopHintAttr::LICMDisabled:
690 case LoopHintAttr::UnrollCount:
691 case LoopHintAttr::UnrollAndJamCount:
692 case LoopHintAttr::VectorizeWidth:
693 case LoopHintAttr::InterleaveCount:
694 case LoopHintAttr::PipelineInitiationInterval:
695 llvm_unreachable(
"Options cannot be disabled.");
699 case LoopHintAttr::Enable:
701 case LoopHintAttr::Vectorize:
702 case LoopHintAttr::Interleave:
705 case LoopHintAttr::Unroll:
708 case LoopHintAttr::UnrollAndJam:
711 case LoopHintAttr::VectorizePredicate:
714 case LoopHintAttr::Distribute:
717 case LoopHintAttr::UnrollCount:
718 case LoopHintAttr::UnrollAndJamCount:
719 case LoopHintAttr::VectorizeWidth:
720 case LoopHintAttr::InterleaveCount:
721 case LoopHintAttr::PipelineDisabled:
722 case LoopHintAttr::PipelineInitiationInterval:
723 case LoopHintAttr::LICMDisabled:
724 llvm_unreachable(
"Options cannot enabled.");
728 case LoopHintAttr::AssumeSafety:
730 case LoopHintAttr::Vectorize:
731 case LoopHintAttr::Interleave:
736 case LoopHintAttr::Unroll:
737 case LoopHintAttr::UnrollAndJam:
738 case LoopHintAttr::VectorizePredicate:
739 case LoopHintAttr::UnrollCount:
740 case LoopHintAttr::UnrollAndJamCount:
741 case LoopHintAttr::VectorizeWidth:
742 case LoopHintAttr::InterleaveCount:
743 case LoopHintAttr::Distribute:
744 case LoopHintAttr::PipelineDisabled:
745 case LoopHintAttr::PipelineInitiationInterval:
746 case LoopHintAttr::LICMDisabled:
747 llvm_unreachable(
"Options cannot be used to assume mem safety.");
751 case LoopHintAttr::Full:
753 case LoopHintAttr::Unroll:
756 case LoopHintAttr::UnrollAndJam:
759 case LoopHintAttr::Vectorize:
760 case LoopHintAttr::Interleave:
761 case LoopHintAttr::UnrollCount:
762 case LoopHintAttr::UnrollAndJamCount:
763 case LoopHintAttr::VectorizeWidth:
764 case LoopHintAttr::InterleaveCount:
765 case LoopHintAttr::Distribute:
766 case LoopHintAttr::PipelineDisabled:
767 case LoopHintAttr::PipelineInitiationInterval:
768 case LoopHintAttr::VectorizePredicate:
769 case LoopHintAttr::LICMDisabled:
770 llvm_unreachable(
"Options cannot be used with 'full' hint.");
774 case LoopHintAttr::FixedWidth:
775 case LoopHintAttr::ScalableWidth:
777 case LoopHintAttr::VectorizeWidth:
785 llvm_unreachable(
"Options cannot be used with 'scalable' hint.");
789 case LoopHintAttr::Numeric:
791 case LoopHintAttr::InterleaveCount:
794 case LoopHintAttr::UnrollCount:
797 case LoopHintAttr::UnrollAndJamCount:
800 case LoopHintAttr::PipelineInitiationInterval:
803 case LoopHintAttr::Unroll:
804 case LoopHintAttr::UnrollAndJam:
805 case LoopHintAttr::VectorizePredicate:
806 case LoopHintAttr::Vectorize:
807 case LoopHintAttr::VectorizeWidth:
808 case LoopHintAttr::Interleave:
809 case LoopHintAttr::Distribute:
810 case LoopHintAttr::PipelineDisabled:
811 case LoopHintAttr::LICMDisabled:
812 llvm_unreachable(
"Options cannot be assigned a value.");
824 llvm::APSInt ArgVal = CE->getResultAsAPSInt();
830 if (CGOpts.OptimizationLevel > 0)
833 if (!CGOpts.UnrollLoops &&
835 StagedAttrs.UnrollCount == 0))
839 push(Header, StartLoc, EndLoc);
843 assert(!Active.empty() &&
"No active loops to pop");
844 Active.back()->finish();
849 if (I->mayReadOrWriteMemory()) {
851 for (
const auto &AL : Active) {
853 if (MDNode *Group = AL->getAccessGroup())
854 AccessGroups.push_back(Group);
856 MDNode *UnionMD =
nullptr;
857 if (AccessGroups.size() == 1)
859 else if (AccessGroups.size() >= 2)
860 UnionMD = MDNode::get(I->getContext(), AccessGroups);
861 I->setMetadata(
"llvm.access.group", UnionMD);
871 if (I->isTerminator()) {
872 for (BasicBlock *Succ : successors(I))
874 I->setMetadata(llvm::LLVMContext::MD_loop, L.
getLoopID());
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Attr - This represents one attribute.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
void setPipelineDisabled(bool S)
Set the pipeline disabled state.
void setUnrollCount(unsigned C)
Set the unroll count for the next loop pushed.
bool hasInfo() const
Returns true if there is LoopInfo on the stack.
void setVectorizeWidth(unsigned W)
Set the vectorize width for the next loop pushed.
void InsertHelper(llvm::Instruction *I) const
Function called by the CodeGenFunction when an instruction is created.
void setDistributeState(bool Enable=true)
Set the next pushed loop as a distribution candidate.
void setParallel(bool Enable=true)
Set the next pushed loop as parallel.
void setInterleaveCount(unsigned C)
Set the interleave count for the next loop pushed.
void setUnrollState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll state.
void setVectorizeScalable(const LoopAttributes::LVEnableState &State)
void setVectorizePredicateState(const LoopAttributes::LVEnableState &State)
Set the next pushed vectorize predicate state.
void pop()
End the current loop.
void setCodeAlign(unsigned C)
Set value of code align for the next loop pushed.
void setLICMDisabled(bool Disabled=true)
Set the next pushed loop LICM disable state.
void push(llvm::BasicBlock *Header, const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc)
Begin a new structured loop.
void setMustProgress(bool P)
Set no progress for the next loop pushed.
void setUnrollAndJamState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll_and_jam state.
void setUnrollAndJamCount(unsigned C)
Set the unroll count for the next loop pushed.
const LoopInfo & getInfo() const
Return the LoopInfo for the current loop.
void setPipelineInitiationInterval(unsigned C)
Set the pipeline initiation interval.
void setVectorizeEnable(bool Enable=true)
Set the next pushed loop 'vectorize.enable'.
Information used when generating a structured loop.
llvm::BasicBlock * getHeader() const
Get the header block of this loop.
LoopInfo(llvm::BasicBlock *Header, const LoopAttributes &Attrs, const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc, LoopInfo *Parent)
Construct a new LoopInfo for the loop with entry Header.
llvm::MDNode * getLoopID() const
Get the loop id metadata for this loop.
void finish()
Create the loop's metadata.
auto * getSpecificAttr(const Container &container)
U cast(CodeGen::Address addr)
Diagnostic wrappers for TextAPI types for error reporting.
Attributes that may be specified on loops.
unsigned UnrollCount
llvm.unroll.
bool MustProgress
Value for whether the loop is required to make progress.
unsigned InterleaveCount
Value for llvm.loop.interleave.count metadata.
LoopAttributes(bool IsParallel=false)
bool IsParallel
Generate llvm.loop.parallel metadata for loads and stores.
bool LICMDisabled
Value for llvm.licm.disable metadata.
LVEnableState VectorizeScalable
LVEnableState UnrollAndJamEnable
Value for llvm.loop.unroll_and_jam.* metadata (enable, disable, or full).
unsigned UnrollAndJamCount
llvm.unroll.
LVEnableState VectorizePredicateEnable
Value for llvm.loop.vectorize.predicate metadata.
LVEnableState DistributeEnable
Value for llvm.loop.distribute.enable metadata.
bool PipelineDisabled
Value for llvm.loop.pipeline.disable metadata.
unsigned CodeAlign
Value for 'llvm.loop.align' metadata.
LVEnableState UnrollEnable
Value for llvm.loop.unroll.* metadata (enable, disable, or full).
unsigned VectorizeWidth
Value for llvm.loop.vectorize.width metadata.
unsigned PipelineInitiationInterval
Value for llvm.loop.pipeline.iicount metadata.
LVEnableState VectorizeEnable
Value for llvm.loop.vectorize.enable metadata.