@@ -31,7 +31,8 @@ std::string SPIRVExecuteTest::generateSimpleSPIRV() {
3131 module ->setTargetTriple (" spir64-unknown-unknown" );
3232 IRBuilder<> builder (ctx);
3333
34- std::vector<Type*> args{Type::getFloatPtrTy (ctx, 1 ), Type::getFloatPtrTy (ctx, 1 )};
34+ std::vector<Type*> args{PointerType::get (ctx, 1 ),
35+ PointerType::get (ctx, 1 )}; // float*, float*
3536 FunctionType* f_type = FunctionType::get (Type::getVoidTy (ctx), args, false );
3637 Function* f = Function::Create (
3738 f_type, GlobalValue::LinkageTypes::ExternalLinkage, " plus1" , module .get ());
@@ -53,11 +54,9 @@ std::string SPIRVExecuteTest::generateSimpleSPIRV() {
5354 Constant* onef = ConstantFP::get (ctx, APFloat (1 .f ));
5455 Value* idx = builder.CreateCall (get_global_idj, zero, " idx" );
5556 auto argit = f->args ().begin ();
56- Value* firstElemSrc =
57- builder.CreateGEP (argit->getType ()->getPointerElementType (), argit, idx, " src.idx" );
57+ Value* firstElemSrc = builder.CreateGEP (Type::getFloatTy (ctx), argit, idx, " src.idx" );
5858 ++argit;
59- Value* firstElemDst =
60- builder.CreateGEP (argit->getType ()->getPointerElementType (), argit, idx, " dst.idx" );
59+ Value* firstElemDst = builder.CreateGEP (Type::getFloatTy (ctx), argit, idx, " dst.idx" );
6160 Value* ldSrc = builder.CreateLoad (Type::getFloatTy (ctx), firstElemSrc, " ld" );
6261 Value* result = builder.CreateFAdd (ldSrc, onef, " foo" );
6362 builder.CreateStore (result, firstElemDst);
@@ -174,7 +173,8 @@ TEST_F(SPIRVExecuteTest, SPIRVBuiltins) {
174173 auto module = read_gen_module_from_bc (genx_path, ctx);
175174 IRBuilder<> builder (ctx);
176175
177- std::vector<Type*> args{Type::getFloatPtrTy (ctx, 1 ), Type::getFloatPtrTy (ctx, 1 )};
176+ std::vector<Type*> args{PointerType::get (ctx, 1 ),
177+ PointerType::get (ctx, 1 )}; // float*, float*
178178 FunctionType* f_type = FunctionType::get (Type::getVoidTy (ctx), args, false );
179179 Function* f = Function::Create (
180180 f_type, GlobalValue::LinkageTypes::ExternalLinkage, " plus1" , module .get ());
@@ -189,11 +189,9 @@ TEST_F(SPIRVExecuteTest, SPIRVBuiltins) {
189189 Constant* onef = ConstantFP::get (ctx, APFloat (1 .f ));
190190 Value* idx = builder.CreateCall (posfn, zero, " idx" );
191191 auto argit = f->args ().begin ();
192- Value* firstElemSrc =
193- builder.CreateGEP (argit->getType ()->getPointerElementType (), argit, idx, " src.idx" );
192+ Value* firstElemSrc = builder.CreateGEP (Type::getFloatTy (ctx), argit, idx, " src.idx" );
194193 ++argit;
195- Value* firstElemDst =
196- builder.CreateGEP (argit->getType ()->getPointerElementType (), argit, idx, " dst.idx" );
194+ Value* firstElemDst = builder.CreateGEP (Type::getFloatTy (ctx), argit, idx, " dst.idx" );
197195 Value* ldSrc = builder.CreateLoad (Type::getFloatTy (ctx), firstElemSrc, " ld" );
198196 Value* result = builder.CreateFAdd (ldSrc, onef, " foo" );
199197 builder.CreateStore (result, firstElemDst);
0 commit comments