| 691 | } |
| 692 | |
| 693 | void LoadTestOpt(scoped_ptr<LlvmCodeGen>& codegen) { |
| 694 | const string func("_Z9loop_nullPii"); |
| 695 | typedef void (*LoopFn)(int*, int); |
| 696 | |
| 697 | string module_file; |
| 698 | PathBuilder::GetFullPath("llvm-ir/test-opt.bc", &module_file); |
| 699 | |
| 700 | ASSERT_OK(CreateFromFile(module_file.c_str(), &codegen)); |
| 701 | EXPECT_TRUE(codegen.get() != nullptr); |
| 702 | codegen->EnableOptimizations(true); |
| 703 | |
| 704 | llvm::Function* fn = codegen->GetFunction(func, false); |
| 705 | EXPECT_TRUE(fn != nullptr); |
| 706 | EXPECT_EQ(fn->arg_size(), 2); |
| 707 | CodegenFnPtr<LoopFn> fn_impl; |
| 708 | AddFunctionToJit(codegen.get(), fn, &fn_impl); |
| 709 | |
| 710 | ASSERT_OK(FinalizeModule(codegen.get())); |
| 711 | ASSERT_TRUE(fn_impl.load() != nullptr); |
| 712 | } |
| 713 | }; |
| 714 | |
| 715 | TEST_P(LlvmOptTest, OptFunction) { |
nothing calls this directly
no test coverage detected