[llvm] 7344f8a - [Orc] Use new pass manager in example
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 07:53:18 PST 2023
Author: Nikita Popov
Date: 2023-02-28T16:53:09+01:00
New Revision: 7344f8a8442a9c3cef159445f71b4f2886ed2798
URL: https://github.com/llvm/llvm-project/commit/7344f8a8442a9c3cef159445f71b4f2886ed2798
DIFF: https://github.com/llvm/llvm-project/commit/7344f8a8442a9c3cef159445f71b4f2886ed2798.diff
LOG: [Orc] Use new pass manager in example
Invoke InstCombine via the new pass manager, instead of the
legacy pass manager.
Added:
Modified:
llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c
Removed:
################################################################################
diff --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c b/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c
index 692529d555435..585aa78e0940a 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c
@@ -21,7 +21,7 @@
#include "llvm-c/LLJIT.h"
#include "llvm-c/Support.h"
#include "llvm-c/Target.h"
-#include "llvm-c/Transforms/Scalar.h"
+#include "llvm-c/Transforms/PassBuilder.h"
#include <stdio.h>
@@ -54,11 +54,10 @@ LLVMOrcThreadSafeModuleRef createDemoModule(void) {
}
LLVMErrorRef myModuleTransform(void *Ctx, LLVMModuleRef Mod) {
- LLVMPassManagerRef PM = LLVMCreatePassManager();
- LLVMAddInstructionCombiningPass(PM);
- LLVMRunPassManager(PM, Mod);
- LLVMDisposePassManager(PM);
- return LLVMErrorSuccess;
+ LLVMPassBuilderOptionsRef Options = LLVMCreatePassBuilderOptions();
+ LLVMErrorRef E = LLVMRunPasses(Mod, "instcombine", NULL, Options);
+ LLVMDisposePassBuilderOptions(Options);
+ return E;
}
LLVMErrorRef transform(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut,
More information about the llvm-commits
mailing list