Skip to content

Commit

Permalink
Code cleanup and formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
neboat committed Jan 13, 2024
1 parent 3ef6373 commit 13eab3e
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ What you expected to happen.

_-OR-_

Built from source:
Built from source:
- `opencilk-project`: `branch` commit# (or tag)
- `cheetah`: `branch` commit# (or tag)
- `productivity-tools`: `branch` commit# (or tag)
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Welcome to the OpenCilk project!

[***OpenCilk***][SchardlLe23] is a state-of-the-art open-source
implementation of the Cilk task-parallel programming platform.
implementation of the Cilk task-parallel programming platform.
OpenCilk supports writing fast parallel programs using the Cilk
task-parallel language extensions to C/C++. In addition, OpenCilk
provides a platform to develop compilers, runtime systems, and
Expand Down Expand Up @@ -226,11 +226,11 @@ For a given Cilk program and input, Cilksan is guaranteed to either detect a
determinacy race, if one exists, or certify that the program is
determinacy-race free. Cilksan is therefore useful for debugging and
regression-testing race bugs in Cilk programs.
For each race that Cilksan detects, it will produce a race report that
includes the memory address being raced on and the call stacks of the two
instructions involved in the race. Cilksan will avoid reporting races where
both racing instructions are atomic operations or protected by a common lock.
both racing instructions are atomic operations or protected by a common lock.
To use Cilksan, compile and link the Cilk program with the additional
flag `-fsanitize=cilk`, and then run it normally. It is also recommended
Expand Down Expand Up @@ -285,8 +285,8 @@ scheduling overhead.
To use Cilkscale, compile and link the Cilk program with the additional
flag `-fcilktool=cilkscale`, and then run the program normally.
By default,Cilkscale reports these measurements in CSV format. Here is an
example of Cilkscale's output.
By default, Cilkscale reports these measurements in CSV format. Here
is an example of Cilkscale's output.
```
tag,work (seconds),span (seconds),parallelism,burdened_span (seconds),burdened_parallelism
,2.07768,0.195024,10.6535,0.195386,10.6337
Expand All @@ -295,7 +295,7 @@ You can redirect Cilkscale's output to a file by setting the
`CILKSCALE_OUT` environment variable to that filename.
By default, Cilkscale measures the whole program execution. Cilkscale also
provides a library API, similar to `clock_gettime()`, to measure specific
provides a library API, similar to `clock_gettime()`, to measure specific
regions of the program. To measure a particular region in a Cilk program:
1. Include the Cilkscale header file, `cilk/cilkscale.h`, in the source
program.
Expand Down Expand Up @@ -368,7 +368,7 @@ int sum_array(int *array, size_t n) {
cilk_for (size_t i = 0; i < n; ++i)
sum += array[i];
return sum;
}
}
```
In this example, the function `zero_i` sets the identity value to be the
integer `0`, and `plus_i` defines a binary reduction of adding two
Expand Down Expand Up @@ -422,7 +422,7 @@ double estimatePi(int64_t n) {
double x = static_cast<double>(xSample) / maxValue;
double y = static_cast<double>(ySample) / maxValue;
double m = (x * x) + (y * y);

// Check if sample is inside of the circle
if (m <= 1)
++inside;
Expand All @@ -436,7 +436,7 @@ OpenCilk also supports the
[pedigree runtime mechanism](https://dl.acm.org/doi/10.1145/2145816.2145841)
for user-defined DPRNGs, using the same `cilk/cilk_api.h` header and
`-lopencilk-pedigrees` library. At any point in a Cilk program, the
`__cilkrts_get_pedigree()` function returns the current pedigree in the
`__cilkrts_get_pedigree()` function returns the current pedigree in the
form of a singly linked list of `__cilkrts_pedigree` nodes.
## OpenCilk's system architecture
Expand Down Expand Up @@ -575,7 +575,7 @@ Found a bug in OpenCilk? Please report it on the
[issue tracker](https://github.com/OpenCilk/opencilk-project/issues).

Have a question or comment? Start a thread on the
[Discussions page](https://github.com/orgs/OpenCilk/discussions) or send us
[Discussions page](https://github.com/orgs/OpenCilk/discussions) or send us
an email at [contact@opencilk.org](mailto:contact@opencilk.org).

Want to contribute to the OpenCilk project? We welcome your
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/Cilk.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ struct CilkOptionSet {
};

} // namespace clang

#endif // LLVM_CLANG_BASIC_CILK_H
3 changes: 1 addition & 2 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2858,8 +2858,7 @@ VarDecl::setInstantiationOfStaticDataMember(VarDecl *VD,
getASTContext().setInstantiatedFromStaticDataMember(this, VD, TSK);
}

bool
VarDecl::isReducer() const {
bool VarDecl::isReducer() const {
if (const HyperobjectType *H = getType()->getAs<HyperobjectType>())
return H->hasCallbacks();
return false;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
ThinLinkOS->keep();
if (DwoOS)
DwoOS->keep();
}
}

static void runThinLTOBackend(
DiagnosticsEngine &Diags, ModuleSummaryIndex *CombinedIndex, Module *M,
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Sema/SemaStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3425,12 +3425,6 @@ StmtResult
Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
Scope *S = CurScope->getBreakParent();
if (!S) {
// // Break from a Cilk for loop is not allowed unless the break is
// // inside a nested loop or switch statement.
// if (isa<CilkForScopeInfo>(getCurFunction())) {
// Diag(BreakLoc, diag::err_cilk_for_cannot_break);
// return StmtError();
// }
// C99 6.8.6.3p1: A break shall appear only in or as a switch/loop body.
return StmtError(Diag(BreakLoc, diag::err_break_not_in_loop_or_switch));
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch(

case Type::Hyperobject:
llvm_unreachable("Implement me");

case Type::Auto:
// C++23 [temp.deduct.funcaddr]/3:
// A placeholder type in the return type of a function template is a
Expand Down
32 changes: 15 additions & 17 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2403,14 +2403,14 @@ Expr *Sema::ValidateReducerCallback(Expr *E, unsigned NumArgs,
return E;

if (T->isNullPtrType())
return ImplicitCastExpr::Create(Context, Context.VoidPtrTy,
CK_NullToPointer, E, nullptr,
VK_PRValue, FPOptionsOverride());
return ImplicitCastExpr::Create(Context, Context.VoidPtrTy,
CK_NullToPointer, E, nullptr, VK_PRValue,
FPOptionsOverride());

if (T->isFunctionType()) {
E = ImplicitCastExpr::Create(Context, Context.getPointerType(T),
CK_FunctionToPointerDecay, E,
nullptr, VK_PRValue, FPOptionsOverride());
CK_FunctionToPointerDecay, E, nullptr,
VK_PRValue, FPOptionsOverride());
T = E->getType(); // Context.getDecayedType(T);
}

Expand All @@ -2419,8 +2419,7 @@ Expr *Sema::ValidateReducerCallback(Expr *E, unsigned NumArgs,
if (const IntegerLiteral *L = dyn_cast<IntegerLiteral>(E)) {
if (L->getValue().isZero())
return ImplicitCastExpr::Create(Context, Context.VoidPtrTy,
CK_NullToPointer, E,
nullptr, VK_PRValue,
CK_NullToPointer, E, nullptr, VK_PRValue,
FPOptionsOverride());
Cast = CK_IntegralToPointer;
}
Expand All @@ -2438,15 +2437,15 @@ Expr *Sema::ValidateReducerCallback(Expr *E, unsigned NumArgs,
}
// TODO: Give these types names for better error messages.
QualType FnTy =
BuildFunctionType(Context.VoidTy, ArgTy, E->getExprLoc(),
DeclarationName(), FunctionProtoType::ExtProtoInfo());
BuildFunctionType(Context.VoidTy, ArgTy, E->getExprLoc(),
DeclarationName(), FunctionProtoType::ExtProtoInfo());
FnTy = BuildPointerType(FnTy, E->getExprLoc(), DeclarationName());

if (T == Context.OverloadTy) {
DeclAccessPair What;
bool Multiple = false;
if (FunctionDecl *F =
ResolveAddressOfOverloadedFunction(E, FnTy, true, What, &Multiple)) {
if (FunctionDecl *F = ResolveAddressOfOverloadedFunction(E, FnTy, true,
What, &Multiple)) {
T = F->getType();
E = BuildDeclRefExpr(F, T, VK_LValue, E->getExprLoc());
T = Context.getPointerType(T);
Expand All @@ -2456,19 +2455,18 @@ Expr *Sema::ValidateReducerCallback(Expr *E, unsigned NumArgs,
}

AssignConvertType Mismatch =
CheckAssignmentConstraints(E->getExprLoc(), FnTy, T);
CheckAssignmentConstraints(E->getExprLoc(), FnTy, T);

if (DiagnoseAssignmentResult(Mismatch, E->getExprLoc(), FnTy, T, E,
AA_Passing)) {
E = new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy,
E->getExprLoc());
E = new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, E->getExprLoc());
Cast = CK_NullToPointer;
} else if (Mismatch == IntToPointer) {
Cast = CK_IntegralToPointer;
}

return ImplicitCastExpr::Create(Context, Context.VoidPtrTy, Cast, E,
nullptr, VK_PRValue, FPOptionsOverride());
return ImplicitCastExpr::Create(Context, Context.VoidPtrTy, Cast, E, nullptr,
VK_PRValue, FPOptionsOverride());
}

QualType Sema::BuildHyperobjectType(QualType Element, Expr *Identity,
Expand Down Expand Up @@ -5907,7 +5905,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
}

case DeclaratorChunk::Hyperobject: {
T = S.BuildHyperobjectType(T, DeclType.Hyper.Arg[0],
T = S.BuildHyperobjectType(T, DeclType.Hyper.Arg[0],
DeclType.Hyper.Arg[1], DeclType.Loc);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Cilk/cilkfor-bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ void down_ne_stride(size_t start, size_t end, size_t stride) {

// CHECK: [[PFORCONDCLEANUP]]:
// CHECK-NEXT: sync within %[[SYNCREG]]

void down_ne_stride_flip(size_t start, size_t end, size_t stride) {
_Cilk_for (size_t i = end; start != i; i -= stride)
bar(i);
Expand Down
1 change: 0 additions & 1 deletion clang/test/Cilk/clangchecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Bar {

const int &getVal(int i) const { return val[i]; }
void incVal(int i) { val[i]++; }

};

int bar(int n);
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Cilk/hyper-complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

extern __complex__ float _Hyperobject c;

// CHECK-LABEL: get_real
// CHECK-LABEL: get_real
float get_real()
{
// CHECK: %[[RAW1:.+]] = call ptr @llvm.hyper.lookup.i64(ptr @c, i64 8, ptr null, ptr null)
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Cilk/hyper-destruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Pennant
Pennant();
Pennant(T*);
~Pennant();

friend class Bag<T>;
};

Expand All @@ -26,7 +26,7 @@ class Bag
public:
Bag();
Bag(Bag<T>*);

~Bag();

static void identity(void *value);
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Cilk/regiontest.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void syncreg_loop(int n) {
_Cilk_for(int i = 0; i < n; ++i) {
baz(i);
}
}
}

// CHECK-LABEL: mixed_spawn_and_loop(
int mixed_spawn_and_loop(int n) {
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Cilk/spawn-decl-with-constructors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef long intT;
template <class floatT> class _point2d;

template <class _floatT> class _vect2d {
public:
public:
typedef _floatT floatT;
typedef _point2d<floatT> pointT;
typedef _vect2d vectT;
Expand All @@ -51,18 +51,18 @@ template <class _floatT> class _vect2d {
vectT operator/(floatT s) {return vectT(x / s, y / s);}
floatT operator[] (int i) {return (i==0) ? x : y;};
floatT dot(vectT v) {return x * v.x + y * v.y;}
floatT cross(vectT v) { return x*v.y - y*v.x; }
floatT cross(vectT v) { return x*v.y - y*v.x; }
floatT maxDim() {return max(x,y);}
floatT Length(void) { return sqrt(x*x+y*y);}
static const int dim = 3;
};

template <class _floatT> class _point2d {
public:
public:
typedef _floatT floatT;
typedef _vect2d<floatT> vectT;
typedef _point2d pointT;
floatT x; floatT y;
floatT x; floatT y;
int dimension() {return 2;}
_point2d(floatT xx,floatT yy) : x(xx),y(yy) {}
_point2d() {x=0;y=0;}
Expand All @@ -86,7 +86,7 @@ template <class _floatT> class _point2d {
floatT yy = y + ((dir & 2) ? offset : -offset);
return pointT(xx,yy);
}
bool outOfBox(pointT pt, floatT hsize) {
bool outOfBox(pointT pt, floatT hsize) {
return ((x - hsize > pt.x) || (x + hsize < pt.x) ||
(y - hsize > pt.y) || (y + hsize < pt.y));
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Cilk/spawn-return.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// RUN: %clang_cc1 -std=c++1z -fopencilk -fsyntax-only -verify %s

int main() { _Cilk_spawn return 0; } // expected-error{{cannot return from within a '_Cilk_spawn' statement}}
int main() { _Cilk_spawn return 0; } // expected-error{{cannot return from within a '_Cilk_spawn' statement}}
4 changes: 2 additions & 2 deletions clang/test/Cilk/trivial-assign-op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
struct event {
float v;
long p;
event(float value, long index, bool type)
event(float value, long index, bool type)
: v(value), p((index << 1) + type) {}
event() {}
};
Expand All @@ -25,7 +25,7 @@ struct cutInfo {
float cutOff;
long numLeft;
long numRight;
cutInfo(float _cost, float _cutOff, long nl, long nr)
cutInfo(float _cost, float _cutOff, long nl, long nr)
: cost(_cost), cutOff(_cutOff), numLeft(nl), numRight(nr) {}
cutInfo() {}
};
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Passes/PassBuilderPipelines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
.needCanonicalLoops(false)
.hoistCommonInsts(true)
.sinkCommonInsts(true)));

if (IsFullLTO) {
FPM.addPass(SCCPPass());
FPM.addPass(InstCombinePass());
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB,
BO->setHasNoUnsignedWrap(AR->hasNoUnsignedWrap());
if (BO->hasNoSignedWrap())
BO->setHasNoSignedWrap(AR->hasNoSignedWrap());

}

Value *ExitCnt = genLoopLimit(
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Tapir/CilkABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ CallInst *CilkABI::EmitCilkSetJmp(IRBuilder<> &B, Value *SF) {
LLVMContext &Ctx = M.getContext();

// We always want to save the floating point state too
Triple T(M.getTargetTriple());
Triple T(M.getTargetTriple());
if (T.getArch() == Triple::x86 || T.getArch() == Triple::x86_64)
EmitSaveFloatingPointState(B, SF);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ declare i32 @_ZL8bsr_wordi(i32 %word) #4
declare zeroext i1 @_ZNV4Lock11lock_sharedEv(%class.Lock* %this) #7

; Function Attrs: noinline nounwind optnone uwtable
declare void @_ZNV4Lock13unlock_sharedEv(%class.Lock* %this) #4
declare void @_ZNV4Lock13unlock_sharedEv(%class.Lock* %this) #4

declare i32 @__gxx_personality_v0(...)

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Tapir/taskframe-shared-exit.ll
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ _ZN6miniFE8copy_boxERK3BoxRS0_.exit: ; preds = %2
if.end: ; preds = %_ZN6miniFE8copy_boxERK3BoxRS0_.exit
; br label %if.end38
invoke void undef(%"struct.miniFE::CSRMatrix"* null, i32 0, i32 0)
to label %if.end38 unwind label %lpad218
to label %if.end38 unwind label %lpad218

if.end38: ; preds = %if.end
br label %if.end55.split
Expand Down

0 comments on commit 13eab3e

Please sign in to comment.