This is an archive of the discontinued LLVM Phabricator instance.

[Test][ORC] Add tests for parts of the LLVM-C OrcJIT v2 API
ClosedPublic

Authored by supergrecko on Apr 14 2021, 1:34 PM.

Details

Summary

This part of the LLVM-C API lacked unit tests after OrcJIT v2 was introduced to LLVM-C in LLVM 12.

Diff Detail

Event Timeline

supergrecko created this revision.Apr 14 2021, 1:34 PM
supergrecko requested review of this revision.Apr 14 2021, 1:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2021, 1:34 PM
lhames accepted this revision.Apr 25 2021, 6:39 PM

The test passes with the following changes:

diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index 7425f8828fc3..6f00c087f273 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -121,7 +121,7 @@ TEST_F(OrcCAPITestBase, JITDylibLookup) {
 
 TEST_F(OrcCAPITestBase, MaterializationUnitCreation) {
   LLVMOrcSymbolStringPoolEntryRef Name =
-      LLVMOrcExecutionSessionIntern(ExecutionSession, "test");
+      LLVMOrcLLJITMangleAndIntern(Jit, "test");
   LLVMJITSymbolFlags Flags = {LLVMJITSymbolGenericFlagsWeak, 0};
   LLVMOrcJITTargetAddress Addr =
       (LLVMOrcJITTargetAddress)(&materializationUnitFn);
@@ -172,13 +172,8 @@ TEST_F(OrcCAPITestBase, ResourceTrackerDefinitionLifetime) {
   LLVMErrorRef Err = LLVMOrcLLJITLookup(Jit, &OutAddr, "sum");
   ASSERT_TRUE(Err);
   ASSERT_FALSE(OutAddr);
-  LLVMOrcExecutionSessionRef ES = LLVMOrcLLJITGetExecutionSession(Jit);
-  // FIXME: Provide a better way of clearing dangling references in
-  //  SymbolStringPool from implicit calls
-  LLVMOrcSymbolStringPoolEntryRef Name =
-      LLVMOrcExecutionSessionIntern(ES, "sum");
-  LLVMOrcReleaseSymbolStringPoolEntry(Name);
-  LLVMOrcReleaseSymbolStringPoolEntry(Name);
+  LLVMOrcReleaseResourceTracker(RT);
+  LLVMConsumeError(Err);
 }
 
 TEST_F(OrcCAPITestBase, ResourceTrackerTransfer) {

It also helped identify a bug in EHFrameRegistrationPlugin::notifyTransferringResources that was fixed in c1baf946e6c. Nice!

With the changes applied this all looks good to me. If you're happy with everything I'll go ahead and commit on your behalf.

This revision is now accepted and ready to land.Apr 25 2021, 6:39 PM