Skip to content

Commit

Permalink
fix llvm 3.3 build
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Apr 11, 2017
1 parent decdf65 commit 7b16106
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,26 +931,22 @@ static inline void maybe_mark_argument_dereferenceable(Argument *A, jl_value_t *
if (!size) {
return;
}
llvm::AttrBuilder Attrs;
Attrs.addDereferenceableAttr(size);
#if JL_LLVM_VERSION >= 50000
A->addAttr(llvm::AttributeList::get(jl_LLVMContext,
A->getArgNo() + 1, Attrs));
#else
A->addAttr(llvm::AttributeSet::get(jl_LLVMContext,
A->getArgNo() + 1, Attrs));
#if JL_LLVM_VERSION >= 30700
A->getParent()->addDereferenceableAttr(A->getArgNo() + 1, size);
#endif
}

static inline Instruction *maybe_mark_load_dereferenceable(Instruction *LI, bool can_be_null, size_t size) {
if (!size) {
return LI;
}
#if JL_LLVM_VERSION >= 30700
llvm::SmallVector<Metadata *, 1> OPs;
OPs.push_back(ConstantAsMetadata::get(ConstantInt::get(T_int64, size)));
LI->setMetadata(can_be_null ? "dereferenceable_or_null" :
"dereferenceable",
MDNode::get(jl_LLVMContext, OPs));
#endif
return LI;
}

Expand Down
2 changes: 2 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5033,7 +5033,9 @@ static jl_returninfo_t get_specsig_function(Module *M, const std::string &name,
continue;
if (ty->isAggregateType()) { // aggregate types are passed by pointer
attributes = attributes.addAttribute(jl_LLVMContext, fsig.size() + 1, Attribute::NoCapture);
#if JL_LLVM_VERSION >= 30500
attributes = attributes.addAttribute(jl_LLVMContext, fsig.size() + 1, Attribute::ReadOnly);
#endif
ty = PointerType::get(ty, 0);
}
fsig.push_back(ty);
Expand Down

0 comments on commit 7b16106

Please sign in to comment.