Michael Ho has posted comments on this change. ( http://gerrit.cloudera.org:8080/8541 )
Change subject: IMPALA-6177: Cleanup incomplete handcrafted IRs before finalizing module ...................................................................... Patch Set 8: (10 comments) http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen-test.cc File be/src/codegen/llvm-codegen-test.cc: http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen-test.cc@167 PS8, Line 167: } Can you please also add a test case in which we don't finalize a handcrafted IR but still use it to replace some call sites in a loaded cross-compiled function ? Not sure if we can recover from this kind of error ? May be it'll crash the test. http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen-test.cc@327 PS8, Line 327: EXPECT_TRUE(VerifyFunction(codegen.get(), string_test_fn)); Does this become unnecessary given you called FinalizeFunction() in CodegenStringTest() ? http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen-test.cc@330 PS8, Line 330: void* jitted_fn = NULL; : AddFunctionToJit(codegen.get(), string_test_fn, &jitted_fn); Same here. http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h File be/src/codegen/llvm-codegen.h: http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@107 PS8, Line 107: build nit: built http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@109 PS8, Line 109: Loaded Cross-compiled http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@219 PS8, Line 219: should must And if FinalizeFunction() is not called on a handcrafted-IR function, it will be deleted during FinalizeModule(), right ? Would be great to mention it somewhere. http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@363 PS8, Line 363: /// FinalizeFunction() on the returned function as it is already materialized. I find this last statement potentially confusing. Most of the time, we call CloneFunction() or GetFunction() to get a copy of the cross-compiled function as template to be customized for a query. And that means we still need to call FinalizeFunction() on the customized function. FinalizeFunction() shouldn't have anything to do with bitcode materialization, right ? http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@385 PS8, Line 385: /// this method. Shouldn't there be a DCHECK in this function to enforce this ? http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.h@765 PS8, Line 765: generated generated from scratch http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.cc File be/src/codegen/llvm-codegen.cc: http://gerrit.cloudera.org:8080/#/c/8541/8/be/src/codegen/llvm-codegen.cc@1062 PS8, Line 1062: deleteBody() Why not fn->eraseFromParent() ? In theory, if there is a bug in some codegen function and we didn't finalize a handcrafted IR but still use it to replace some call sites in a loaded cross-compiled function, things may still work if just delete the function body but that may generate wrong result, right ? If we remove the unfinalized IR function altogether from the module, the compilation should fail, right ? -- To view, visit http://gerrit.cloudera.org:8080/8541 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: If975cfb3906482b36dd6ede32ca81de6fcee1d7f Gerrit-Change-Number: 8541 Gerrit-PatchSet: 8 Gerrit-Owner: Bikramjeet Vig <[email protected]> Gerrit-Reviewer: Bikramjeet Vig <[email protected]> Gerrit-Reviewer: Michael Ho <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Comment-Date: Thu, 07 Dec 2017 23:28:18 +0000 Gerrit-HasComments: Yes
