Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 0c64806

Browse files
mbutrovichpmenon
authored andcommitted
Resolves Clang warnings and LLVM assertion failure on Mac (#1379)
* Resolves Mac Clang and LLVM issues introduced by PR #1304. Passes make check. * Added LOG_ERROR to ~FunctionBuilder(). * Removed assertion from ~FunctionBuilder() since it is essentially an exception (which was the whole point of this change in the first place) and changed an assertion in ~VectorizedLoop() to LOG_ERROR.
1 parent 9401245 commit 0c64806

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

src/codegen/code_context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ CodeContext::CodeContext()
224224
int64_type_ = llvm::Type::getInt64Ty(*context_);
225225
double_type_ = llvm::Type::getDoubleTy(*context_);
226226
void_type_ = llvm::Type::getVoidTy(*context_);
227-
void_ptr_type_ = llvm::Type::getVoidTy(*context_)->getPointerTo();
227+
void_ptr_type_ = llvm::Type::getInt8PtrTy(*context_);
228228
char_ptr_type_ = llvm::Type::getInt8PtrTy(*context_);
229229
}
230230

src/codegen/function_builder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ FunctionBuilder::FunctionBuilder(
131131
cc,
132132
ConstructFunction(cc, name, FunctionDeclaration::Visibility::External,
133133
ret_type, args)) {}
134-
134+
135135
FunctionBuilder::~FunctionBuilder() {
136136
if (!finished_) {
137-
throw Exception{"Missing call to FunctionBuilder::ReturnAndFinish()"};
137+
LOG_ERROR(
138+
"Missing call to FunctionBuilder::ReturnAndFinish() for function '%s'",
139+
func_->getName().data());
138140
}
139141
}
140142

src/codegen/lang/vectorized_loop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ VectorizedLoop::VectorizedLoop(CodeGen &codegen, llvm::Value *num_elements,
3333
}
3434

3535
VectorizedLoop::~VectorizedLoop() {
36-
PELOTON_ASSERT(ended_ && "You didn't call lang::VectorizedLoop::LoopEnd()!");
36+
if (!ended_) {
37+
LOG_ERROR("You didn't call lang::VectorizedLoop::LoopEnd()!");
38+
}
3739
}
3840

3941
VectorizedLoop::Range VectorizedLoop::GetCurrentRange() const {

src/codegen/operator/table_scan_translator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void TableScanTranslator::ProduceParallel() const {
216216
codegen.Int64Type()};
217217

218218
// Parallel production
219-
auto producer = [this, &codegen, &table](
219+
auto producer = [this, &codegen](
220220
ConsumerContext &ctx, const std::vector<llvm::Value *> params) {
221221
PELOTON_ASSERT(params.size() == 2);
222222
llvm::Value *tilegroup_start = params[0];

src/codegen/util/sorter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void Sorter::SortParallel(
268268
return !(cmp_func_(*l.first, *r.first) < 0);
269269
};
270270
for (auto &work : merge_work) {
271-
work_pool.SubmitTask([&work, &latch, &heap_cmp, &comp] {
271+
work_pool.SubmitTask([&work, &latch, &heap_cmp] {
272272
std::priority_queue<MergeWork::InputRange,
273273
std::vector<MergeWork::InputRange>,
274274
decltype(heap_cmp)> heap(heap_cmp,

test/codegen/hash_table_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ TEST_F(HashTableTest, CanInsertUniqueKeys) {
9494
// Lookup
9595
for (const auto &key : keys) {
9696
uint32_t count = 0;
97-
std::function<void(const Value &v)> f = [&key, &count](const Value &v) {
97+
std::function<void(const Value &v)> f = [&key, &count, &c1](const Value &v) {
9898
EXPECT_EQ(key.k2, v.v1)
9999
<< "Value's [v1] found in table doesn't match insert key";
100100
EXPECT_EQ(c1, v.v4) << "Value's [v4] doesn't match constant";
@@ -136,7 +136,7 @@ TEST_F(HashTableTest, CanInsertDuplicateKeys) {
136136
// Lookup
137137
for (const auto &key : keys) {
138138
uint32_t count = 0;
139-
std::function<void(const Value &v)> f = [&key, &count](const Value &v) {
139+
std::function<void(const Value &v)> f = [&key, &count, &c1](const Value &v) {
140140
EXPECT_EQ(key.k2, v.v1)
141141
<< "Value's [v1] found in table doesn't match insert key";
142142
EXPECT_EQ(c1, v.v4) << "Value's [v4] doesn't match constant";
@@ -183,7 +183,7 @@ TEST_F(HashTableTest, CanInsertLazilyWithDups) {
183183
// Lookups should succeed
184184
for (const auto &key : keys) {
185185
uint32_t count = 0;
186-
std::function<void(const Value &v)> f = [&key, &count](const Value &v) {
186+
std::function<void(const Value &v)> f = [&key, &count, &c1](const Value &v) {
187187
EXPECT_EQ(key.k2, v.v1)
188188
<< "Value's [v1] found in table doesn't match insert key";
189189
EXPECT_EQ(c1, v.v4) << "Value's [v4] doesn't match constant";
@@ -219,7 +219,7 @@ TEST_F(HashTableTest, ParallelMerge) {
219219
};
220220

221221
// Insert function
222-
auto insert_fn = [&add_key, &exec_ctx, &to_insert](uint64_t tid) {
222+
auto insert_fn = [&add_key, &exec_ctx](uint64_t tid) {
223223
// Get the local table for this thread
224224
auto *table = reinterpret_cast<codegen::util::HashTable *>(
225225
exec_ctx.GetThreadStates().AccessThreadState(tid));

0 commit comments

Comments
 (0)