Fix free cast
This commit is contained in:
parent
52d56133ed
commit
bc543995a1
|
@ -0,0 +1,23 @@
|
||||||
|
// RUN: mlir-clang %s --function=* -S | FileCheck %s
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
struct band {
|
||||||
|
int dimX;
|
||||||
|
};
|
||||||
|
struct dimensions {
|
||||||
|
struct band LL;
|
||||||
|
};
|
||||||
|
void writeNStage2DDWT(struct dimensions* bandDims)
|
||||||
|
{
|
||||||
|
free(bandDims);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK: func @writeNStage2DDWT(%arg0: !llvm.ptr<struct<(struct<(i32)>)>>) attributes {llvm.linkage = #llvm.linkage<external>} {
|
||||||
|
// CHECK-NEXT: %c1_i64 = arith.constant 1 : i64
|
||||||
|
// CHECK-NEXT: %0 = llvm.alloca %c1_i64 x !llvm.ptr<struct<(struct<(i32)>)>> : (i64) -> !llvm.ptr<ptr<struct<(struct<(i32)>)>>>
|
||||||
|
// CHECK-NEXT: llvm.store %arg0, %0 : !llvm.ptr<ptr<struct<(struct<(i32)>)>>>
|
||||||
|
// CHECK-NEXT: %1 = llvm.load %0 : !llvm.ptr<ptr<struct<(struct<(i32)>)>>>
|
||||||
|
// CHECK-NEXT: %2 = llvm.bitcast %1 : !llvm.ptr<struct<(struct<(i32)>)>> to !llvm.ptr<i8>
|
||||||
|
// CHECK-NEXT: llvm.call @free(%2) : (!llvm.ptr<i8>) -> ()
|
||||||
|
// CHECK-NEXT: return
|
||||||
|
// CHECK-NEXT: }
|
|
@ -1499,7 +1499,8 @@ MLIRScanner::EmitGPUCallExpr(clang::CallExpr *expr) {
|
||||||
if (arg.getType().isa<mlir::LLVM::LLVMPointerType>()) {
|
if (arg.getType().isa<mlir::LLVM::LLVMPointerType>()) {
|
||||||
auto callee = EmitCallee(expr->getCallee());
|
auto callee = EmitCallee(expr->getCallee());
|
||||||
auto strcmpF = Glob.GetOrCreateLLVMFunction(callee);
|
auto strcmpF = Glob.GetOrCreateLLVMFunction(callee);
|
||||||
mlir::Value args[] = {arg};
|
mlir::Value args[] = {builder.create<LLVM::BitcastOp>(
|
||||||
|
loc, LLVM::LLVMPointerType::get(builder.getIntegerType(8)), arg)};
|
||||||
builder.create<mlir::LLVM::CallOp>(loc, strcmpF, args);
|
builder.create<mlir::LLVM::CallOp>(loc, strcmpF, args);
|
||||||
} else {
|
} else {
|
||||||
builder.create<mlir::memref::DeallocOp>(loc, arg);
|
builder.create<mlir::memref::DeallocOp>(loc, arg);
|
||||||
|
|
Loading…
Reference in New Issue