Skip to content

Commit 91b069a

Browse files
committed
R4: Addressing review comments
1 parent e923c69 commit 91b069a

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ class OpenMPIRBuilder {
512512
return allocaInst;
513513
}
514514
};
515-
516515
/// Initialize the internal state, this will put structures types and
517516
/// potentially other helpers into the underlying module. Must be called
518517
/// before any other method and only once! This internal state includes types
@@ -782,8 +781,8 @@ class OpenMPIRBuilder {
782781
/// at the outermost loop of a loop nest. If not set,
783782
/// defaults to the preheader of the generated loop.
784783
/// \param Name Base name used to derive BB and instruction names.
785-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
786-
/// `ScanInfoInitialize`.
784+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
785+
/// `ScanInfoInitialize`.
787786
///
788787
/// \returns A vector containing Loop Info of Input Loop and Scan Loop.
789788
Expected<SmallVector<llvm::CanonicalLoopInfo *>> createCanonicalScanLoops(
@@ -861,7 +860,7 @@ class OpenMPIRBuilder {
861860
/// \param Name Base name used to derive BB and instruction names.
862861
/// \param InScan Whether loop has a scan reduction specified.
863862
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
864-
/// `ScanInfoInitialize`.
863+
/// `ScanInfoInitialize`.
865864
///
866865
/// \returns An object representing the created control flow structure which
867866
/// can be used for loop-associated directives.
@@ -1604,9 +1603,9 @@ class OpenMPIRBuilder {
16041603
/// Helper function for CreateCanonicalScanLoops to create InputLoop
16051604
/// in the firstGen and Scan Loop in the SecondGen
16061605
/// \param InputLoopGen Callback for generating the loop for input phase
1607-
/// \param ScanLoopGen Callback for generating the loop for scan phase
1606+
/// \param ScanLoopGen Callback for generating the loop for scan phase
16081607
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1609-
/// `ScanInfoInitialize`.
1608+
/// `ScanInfoInitialize`.
16101609
///
16111610
/// \return error if any produced, else return success.
16121611
Error emitScanBasedDirectiveIR(
@@ -1615,15 +1614,16 @@ class OpenMPIRBuilder {
16151614
ScanInfo *ScanRedInfo);
16161615

16171616
/// Creates the basic blocks required for scan reduction.
1618-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1619-
/// `ScanInfoInitialize`.
1617+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1618+
/// `ScanInfoInitialize`.
16201619
void createScanBBs(ScanInfo *ScanRedInfo);
16211620

16221621
/// Dynamically allocates the buffer needed for scan reduction.
1623-
/// \param AllocaIP The IP where possibly-shared pointer of buffer needs to be
1624-
/// declared. \param ScanVars Scan Variables.
1625-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1626-
/// `ScanInfoInitialize`.
1622+
/// \param AllocaIP The IP where possibly-shared pointer of buffer needs to
1623+
/// be declared.
1624+
/// \param ScanVars Scan Variables.
1625+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1626+
/// `ScanInfoInitialize`.
16271627
///
16281628
/// \return error if any produced, else return success.
16291629
Error emitScanBasedDirectiveDeclsIR(InsertPointTy AllocaIP,
@@ -1633,8 +1633,8 @@ class OpenMPIRBuilder {
16331633

16341634
/// Copies the result back to the reduction variable.
16351635
/// \param ReductionInfos Array type containing the ReductionOps.
1636-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1637-
/// `ScanInfoInitialize`.
1636+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
1637+
/// `ScanInfoInitialize`.
16381638
///
16391639
/// \return error if any produced, else return success.
16401640
Error emitScanBasedDirectiveFinalsIR(
@@ -2268,6 +2268,8 @@ class OpenMPIRBuilder {
22682268
/// Collection of owned canonical loop objects that eventually need to be
22692269
/// free'd.
22702270
std::forward_list<CanonicalLoopInfo> LoopInfos;
2271+
2272+
/// Collection of owned ScanInfo objects that eventually need to be free'd.
22712273
std::forward_list<ScanInfo> ScanInfos;
22722274

22732275
/// Add a new region that will be outlined later.
@@ -2730,16 +2732,17 @@ class OpenMPIRBuilder {
27302732
/// and scan loop returned by `CreateCanonicalScanLoops`. The following
27312733
/// is the code that is generated, `buffer` and `span` are expected to be
27322734
/// populated before executing the generated code.
2733-
///
2734-
/// for (int k = 0; k != ceil(log2(span)); ++k) {
2735-
/// i=pow(2,k)
2736-
/// for (size cnt = last_iter; cnt >= i; --cnt)
2737-
/// buffer[cnt] op= buffer[cnt-i];
2738-
/// }
2735+
/// \code{c}
2736+
/// for (int k = 0; k != ceil(log2(span)); ++k) {
2737+
/// i=pow(2,k)
2738+
/// for (size cnt = last_iter; cnt >= i; --cnt)
2739+
/// buffer[cnt] op= buffer[cnt-i];
2740+
/// }
2741+
/// \endcode
27392742
/// \param Loc The insert and source location description.
27402743
/// \param ReductionInfos Array type containing the ReductionOps.
2741-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
2742-
/// `ScanInfoInitialize`.
2744+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
2745+
/// `ScanInfoInitialize`.
27432746
///
27442747
/// \returns The insertion position *after* the masked.
27452748
InsertPointOrErrorTy emitScanReduction(
@@ -2752,19 +2755,20 @@ class OpenMPIRBuilder {
27522755
/// is executed, 2. whether exclusive or inclusive scan is used.
27532756
///
27542757
/// \param Loc The insert and source location description.
2755-
/// \param AllocaIP The IP where the temporary buffer for scan reduction
2756-
// needs to be allocated.
2757-
/// \param ScanVars Scan Variables.
2758+
/// \param AllocaIP The IP where the temporary buffer for scan reduction
2759+
// needs to be allocated.
2760+
/// \param ScanVars Scan Variables.
27582761
/// \param IsInclusive Whether it is an inclusive or exclusive scan.
2759-
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
2760-
/// `ScanInfoInitialize`.
2762+
/// \param ScanRedInfo Pointer to the ScanInfo objected created using
2763+
/// `ScanInfoInitialize`.
27612764
///
27622765
/// \returns The insertion position *after* the scan.
27632766
InsertPointOrErrorTy createScan(const LocationDescription &Loc,
27642767
InsertPointTy AllocaIP,
27652768
ArrayRef<llvm::Value *> ScanVars,
27662769
ArrayRef<llvm::Type *> ScanVarsType,
27672770
bool IsInclusive, ScanInfo *ScanRedInfo);
2771+
27682772
/// Generator for '#omp critical'
27692773
///
27702774
/// \param Loc The insert and source location description.

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
//===- OpenMPIRBuilder.cpp - Builder for LLVM-IR for OpenMP directives ----===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -60,8 +59,6 @@
6059
#include "llvm/Transforms/Utils/LoopPeel.h"
6160
#include "llvm/Transforms/Utils/UnrollLoop.h"
6261

63-
#include <cassert>
64-
#include <cstddef>
6562
#include <cstdint>
6663
#include <optional>
6764

@@ -4024,10 +4021,10 @@ OpenMPIRBuilder::createMasked(const LocationDescription &Loc,
40244021
/*Conditional*/ true, /*hasFinalize*/ true);
40254022
}
40264023

4027-
llvm::CallInst *emitNoUnwindRuntimeCall(IRBuilder<> &Builder,
4028-
llvm::FunctionCallee Callee,
4029-
ArrayRef<llvm::Value *> Args,
4030-
const llvm::Twine &Name) {
4024+
static llvm::CallInst *emitNoUnwindRuntimeCall(IRBuilder<> &Builder,
4025+
llvm::FunctionCallee Callee,
4026+
ArrayRef<llvm::Value *> Args,
4027+
const llvm::Twine &Name) {
40314028
llvm::CallInst *Call = Builder.CreateCall(
40324029
Callee, Args, SmallVector<llvm::OperandBundleDef, 1>(), Name);
40334030
Call->setDoesNotThrow();

0 commit comments

Comments
 (0)