[ExecutionEngine] Fix GEP type
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 17 Jul 2021 21:43:36 +0000 (23:43 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 17 Jul 2021 21:45:00 +0000 (23:45 +0200)
Fix bug introduced in 2c68ecccc9ee1fb37eca318a9b3572813a137cd5,
the GEP type was off-by-ptr. Apparently I didn't run the MLIR
tests.

mlir/lib/ExecutionEngine/ExecutionEngine.cpp

index dba1dd0..f664b58 100644 (file)
@@ -180,7 +180,7 @@ static void packFunctionArguments(Module *module) {
       llvm::Value *argIndex = llvm::Constant::getIntegerValue(
           builder.getInt64Ty(), APInt(64, indexedArg.index()));
       llvm::Value *argPtrPtr = builder.CreateGEP(
-          builder.getInt8Ty(), argList, argIndex);
+          builder.getInt8PtrTy(), argList, argIndex);
       llvm::Value *argPtr = builder.CreateLoad(builder.getInt8PtrTy(),
                                                argPtrPtr);
       llvm::Type *argTy = indexedArg.value().getType();
@@ -197,7 +197,7 @@ static void packFunctionArguments(Module *module) {
       llvm::Value *retIndex = llvm::Constant::getIntegerValue(
           builder.getInt64Ty(), APInt(64, llvm::size(func.args())));
       llvm::Value *retPtrPtr =
-          builder.CreateGEP(builder.getInt8Ty(), argList, retIndex);
+          builder.CreateGEP(builder.getInt8PtrTy(), argList, retIndex);
       llvm::Value *retPtr = builder.CreateLoad(builder.getInt8PtrTy(),
                                                retPtrPtr);
       retPtr = builder.CreateBitCast(retPtr, result->getType()->getPointerTo());