@@ -574,6 +574,12 @@ MDNode *LoopInfo::createMetadata(
574574 LoopProperties.push_back (MDNode::get (Ctx, Vals));
575575 }
576576
577+ // nofusion attribute corresponds to 'llvm.loop.fusion.disable' metadata
578+ if (Attrs.SYCLNofusionEnable ) {
579+ Metadata *Vals[] = {MDString::get (Ctx, " llvm.loop.fusion.disable" )};
580+ LoopProperties.push_back (MDNode::get (Ctx, Vals));
581+ }
582+
577583 if (Attrs.SYCLSpeculatedIterationsEnable ) {
578584 Metadata *Vals[] = {
579585 MDString::get (Ctx, " llvm.loop.intel.speculated.iterations.count" ),
@@ -601,7 +607,7 @@ LoopAttributes::LoopAttributes(bool IsParallel)
601607 SYCLSpeculatedIterationsNIterations(0 ), UnrollCount(0 ),
602608 UnrollAndJamCount(0 ), DistributeEnable(LoopAttributes::Unspecified),
603609 PipelineDisabled(false ), PipelineInitiationInterval(0 ),
604- MustProgress(false ) {}
610+ SYCLNofusionEnable( false ), MustProgress(false ) {}
605611
606612void LoopAttributes::clear () {
607613 IsParallel = false ;
@@ -628,6 +634,7 @@ void LoopAttributes::clear() {
628634 DistributeEnable = LoopAttributes::Unspecified;
629635 PipelineDisabled = false ;
630636 PipelineInitiationInterval = 0 ;
637+ SYCLNofusionEnable = false ;
631638 MustProgress = false ;
632639}
633640
@@ -661,7 +668,7 @@ LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs,
661668 Attrs.UnrollEnable == LoopAttributes::Unspecified &&
662669 Attrs.UnrollAndJamEnable == LoopAttributes::Unspecified &&
663670 Attrs.DistributeEnable == LoopAttributes::Unspecified && !StartLoc &&
664- !EndLoc && !Attrs.MustProgress )
671+ Attrs. SYCLNofusionEnable == false && !EndLoc && !Attrs.MustProgress )
665672 return ;
666673
667674 TempLoopID = MDNode::getTemporary (Header->getContext (), None);
@@ -967,6 +974,8 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
967974 // For attribute speculated_iterations:
968975 // n - 'llvm.loop.intel.speculated.iterations.count, i32 n' metadata will be
969976 // emitted
977+ // For attribute nofusion:
978+ // 'llvm.loop.fusion.disable' metadata will be emitted
970979 for (const auto *Attr : Attrs) {
971980 const SYCLIntelFPGAIVDepAttr *IntelFPGAIVDep =
972981 dyn_cast<SYCLIntelFPGAIVDepAttr>(Attr);
@@ -983,10 +992,13 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
983992 dyn_cast<SYCLIntelFPGAMaxInterleavingAttr>(Attr);
984993 const SYCLIntelFPGASpeculatedIterationsAttr *IntelFPGASpeculatedIterations =
985994 dyn_cast<SYCLIntelFPGASpeculatedIterationsAttr>(Attr);
995+ const SYCLIntelFPGANofusionAttr *IntelFPGANofusion =
996+ dyn_cast<SYCLIntelFPGANofusionAttr>(Attr);
986997
987998 if (!IntelFPGAIVDep && !IntelFPGAII && !IntelFPGAMaxConcurrency &&
988999 !IntelFPGALoopCoalesce && !IntelFPGADisableLoopPipelining &&
989- !IntelFPGAMaxInterleaving && !IntelFPGASpeculatedIterations)
1000+ !IntelFPGAMaxInterleaving && !IntelFPGASpeculatedIterations &&
1001+ !IntelFPGANofusion)
9901002 continue ;
9911003
9921004 if (IntelFPGAIVDep)
@@ -1031,6 +1043,9 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
10311043 ->getIntegerConstantExpr (Ctx)
10321044 ->getSExtValue ());
10331045 }
1046+
1047+ if (IntelFPGANofusion)
1048+ setSYCLNofusionEnable ();
10341049 }
10351050
10361051 setMustProgress (MustProgress);
0 commit comments