Skip to content

Commit

Permalink
Fix for the removed DataLayout constructor. (#8391)
Browse files Browse the repository at this point in the history
* Fix for the removed DataLayout constructor.

* Update CodeGen_LLVM.cpp

* Update CodeGen_LLVM.cpp

* Update CodeGen_LLVM.cpp

---------

Co-authored-by: Steven Johnson <srj@google.com>
  • Loading branch information
mcourteaux and steven-johnson committed Aug 13, 2024
1 parent 6dcdfb5 commit 818f42d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CodeGen_LLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ Value *CodeGen_LLVM::codegen_buffer_pointer(const string &buffer, Halide::Type t

Value *CodeGen_LLVM::codegen_buffer_pointer(Value *base_address, Halide::Type type, Expr index) {
// Promote index to 64-bit on targets that use 64-bit pointers.
llvm::DataLayout d(module.get());
const llvm::DataLayout &d = module->getDataLayout();
if (promote_indices() && d.getPointerSize() == 8) {
index = promote_64(index);
}
Expand Down Expand Up @@ -1951,7 +1951,7 @@ Value *CodeGen_LLVM::codegen_buffer_pointer(Value *base_address, Halide::Type ty
}

// Promote index to 64-bit on targets that use 64-bit pointers.
llvm::DataLayout d(module.get());
const llvm::DataLayout &d = module->getDataLayout();
if (d.getPointerSize() == 8) {
llvm::Type *index_type = index->getType();
llvm::Type *desired_index_type = i64_t;
Expand Down Expand Up @@ -3286,7 +3286,7 @@ void CodeGen_LLVM::visit(const Call *op) {
} else if (op->is_intrinsic(Call::undef)) {
user_error << "undef not eliminated before code generation. Please report this as a Halide bug.\n";
} else if (op->is_intrinsic(Call::size_of_halide_buffer_t)) {
llvm::DataLayout d(module.get());
const llvm::DataLayout &d = module->getDataLayout();
value = ConstantInt::get(i32_t, (int)d.getTypeAllocSize(halide_buffer_t_type));
} else if (op->is_intrinsic(Call::strict_float)) {
IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::FastMathFlagGuard guard(*builder);
Expand Down Expand Up @@ -4466,7 +4466,7 @@ Value *CodeGen_LLVM::create_alloca_at_entry(llvm::Type *t, int n, bool zero_init
Value *size = ConstantInt::get(i32_t, n);
AllocaInst *ptr = builder->CreateAlloca(t, size, name);
int align = native_vector_bits() / 8;
llvm::DataLayout d(module.get());
const llvm::DataLayout &d = module->getDataLayout();
int allocated_size = n * (int)d.getTypeAllocSize(t);
if (t->isVectorTy() || n > 1) {
ptr->setAlignment(llvm::Align(align));
Expand Down

0 comments on commit 818f42d

Please sign in to comment.