ac: fix build after LLVM 5.0 SVN r300718
authorChristoph Haag <haagch+mesadev@frickel.club>
Thu, 20 Apr 2017 08:34:18 +0000 (10:34 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 20 Apr 2017 08:58:19 +0000 (10:58 +0200)
v2: previously getWithDereferenceableBytes() exists, but addAttr() doesn't take that type

Signed-off-by: Christoph Haag <haagch+mesadev@frickel.club>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-and-reviewed-by: Mike Lothian <mike@fireburn.co.uk>
src/amd/common/ac_llvm_helper.cpp

index d9ea4b162e90d91bc1ac0c67a24c4dbfb39f9f72..11fa80920d607b16b51e23a618ba9eff74df9de8 100644 (file)
@@ -44,9 +44,13 @@ typedef AttributeSet AttributeList;
 void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
 {
    llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
+#if HAVE_LLVM < 0x0500
    llvm::AttrBuilder B;
    B.addDereferenceableAttr(bytes);
    A->addAttr(llvm::AttributeList::get(A->getContext(), A->getArgNo() + 1,  B));
+#else
+   A->addAttr(llvm::Attribute::getWithDereferenceableBytes(A->getContext(), bytes));
+#endif
 }
 
 bool ac_is_sgpr_param(LLVMValueRef arg)