Skip to content

Commit 4a0bb25

Browse files
committed
address review comments
Signed-off-by: Soumi Manna <[email protected]>
1 parent 0acb86b commit 4a0bb25

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

clang/lib/CodeGen/CGLoopInfo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ MDNode *LoopInfo::createMetadata(
552552
}
553553

554554
// Setting max_concurrency attribute with number of threads
555-
if (Attrs.SYCLMaxConcurrencyNThreads.hasValue()) {
555+
if (Attrs.SYCLMaxConcurrencyNThreads) {
556556
Metadata *Vals[] = {
557557
MDString::get(Ctx, "llvm.loop.max_concurrency.count"),
558558
ConstantAsMetadata::get(ConstantInt::get(
@@ -582,7 +582,7 @@ MDNode *LoopInfo::createMetadata(
582582
LoopProperties.push_back(MDNode::get(Ctx, Vals));
583583
}
584584

585-
if (Attrs.SYCLMaxInterleavingNInvocations.hasValue()) {
585+
if (Attrs.SYCLMaxInterleavingNInvocations) {
586586
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.max_interleaving.count"),
587587
ConstantAsMetadata::get(ConstantInt::get(
588588
llvm::Type::getInt32Ty(Ctx),
@@ -596,7 +596,7 @@ MDNode *LoopInfo::createMetadata(
596596
LoopProperties.push_back(MDNode::get(Ctx, Vals));
597597
}
598598

599-
if (Attrs.SYCLSpeculatedIterationsNIterations.hasValue()) {
599+
if (Attrs.SYCLSpeculatedIterationsNIterations) {
600600
Metadata *Vals[] = {
601601
MDString::get(Ctx, "llvm.loop.intel.speculated.iterations.count"),
602602
ConstantAsMetadata::get(
@@ -673,12 +673,12 @@ LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs,
673673
Attrs.VectorizeScalable == LoopAttributes::Unspecified &&
674674
Attrs.InterleaveCount == 0 && !Attrs.GlobalSYCLIVDepInfo.hasValue() &&
675675
Attrs.ArraySYCLIVDepInfo.empty() && Attrs.SYCLIInterval == 0 &&
676-
!Attrs.SYCLMaxConcurrencyNThreads.hasValue() &&
676+
!Attrs.SYCLMaxConcurrencyNThreads &&
677677
Attrs.SYCLLoopCoalesceEnable == false &&
678678
Attrs.SYCLLoopCoalesceNLevels == 0 &&
679679
Attrs.SYCLLoopPipeliningDisable == false &&
680-
!Attrs.SYCLMaxInterleavingNInvocations.hasValue() &&
681-
!Attrs.SYCLSpeculatedIterationsNIterations.hasValue() &&
680+
!Attrs.SYCLMaxInterleavingNInvocations &&
681+
!Attrs.SYCLSpeculatedIterationsNIterations &&
682682
Attrs.SYCLIntelFPGAVariantCount.empty() && Attrs.UnrollCount == 0 &&
683683
Attrs.UnrollAndJamCount == 0 && !Attrs.PipelineDisabled &&
684684
Attrs.PipelineInitiationInterval == 0 &&
@@ -1028,7 +1028,7 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
10281028
const auto *CE =
10291029
cast<ConstantExpr>(IntelFPGAMaxConcurrency->getNThreadsExpr());
10301030
llvm::APSInt ArgVal = CE->getResultAsAPSInt();
1031-
addSYCLMaxConcurrencyNThreads(ArgVal.getSExtValue());
1031+
setSYCLMaxConcurrencyNThreads(ArgVal.getSExtValue());
10321032
}
10331033

10341034
if (const auto *IntelFPGALoopCountAvg =
@@ -1062,15 +1062,15 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
10621062
dyn_cast<SYCLIntelFPGAMaxInterleavingAttr>(A)) {
10631063
const auto *CE = cast<ConstantExpr>(IntelFPGAMaxInterleaving->getNExpr());
10641064
llvm::APSInt ArgVal = CE->getResultAsAPSInt();
1065-
addSYCLMaxInterleavingNInvocations(ArgVal.getSExtValue());
1065+
setSYCLMaxInterleavingNInvocations(ArgVal.getSExtValue());
10661066
}
10671067

10681068
if (const auto *IntelFPGASpeculatedIterations =
10691069
dyn_cast<SYCLIntelFPGASpeculatedIterationsAttr>(A)) {
10701070
const auto *CE =
10711071
cast<ConstantExpr>(IntelFPGASpeculatedIterations->getNExpr());
10721072
llvm::APSInt ArgVal = CE->getResultAsAPSInt();
1073-
addSYCLSpeculatedIterationsNIterations(ArgVal.getSExtValue());
1073+
setSYCLSpeculatedIterationsNIterations(ArgVal.getSExtValue());
10741074
}
10751075

10761076
if (isa<SYCLIntelFPGANofusionAttr>(A))

clang/lib/CodeGen/CGLoopInfo.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/IR/DebugLoc.h"
2020
#include "llvm/IR/Value.h"
2121
#include "llvm/Support/Compiler.h"
22+
#include "llvm/ADT/Optional.h"
2223

2324
namespace llvm {
2425
class BasicBlock;
@@ -354,8 +355,8 @@ class LoopInfoStack {
354355
/// Set value of an initiation interval for the next loop pushed.
355356
void setSYCLIInterval(unsigned C) { StagedAttrs.SYCLIInterval = C; }
356357

357-
/// Add value of max_concurrency for the next loop pushed.
358-
void addSYCLMaxConcurrencyNThreads(unsigned C) {
358+
/// Set value of max_concurrency for the next loop pushed.
359+
void setSYCLMaxConcurrencyNThreads(unsigned C) {
359360
StagedAttrs.SYCLMaxConcurrencyNThreads = C;
360361
}
361362

@@ -374,13 +375,13 @@ class LoopInfoStack {
374375
StagedAttrs.SYCLLoopPipeliningDisable = true;
375376
}
376377

377-
/// Add value of max interleaved invocations for the next loop pushed.
378-
void addSYCLMaxInterleavingNInvocations(unsigned C) {
378+
/// Set value of max interleaved invocations for the next loop pushed.
379+
void setSYCLMaxInterleavingNInvocations(unsigned C) {
379380
StagedAttrs.SYCLMaxInterleavingNInvocations = C;
380381
}
381382

382-
/// Add value of speculated iterations for the next loop pushed.
383-
void addSYCLSpeculatedIterationsNIterations(unsigned C) {
383+
/// Set value of speculated iterations for the next loop pushed.
384+
void setSYCLSpeculatedIterationsNIterations(unsigned C) {
384385
StagedAttrs.SYCLSpeculatedIterationsNIterations = C;
385386
}
386387

0 commit comments

Comments
 (0)