llvmlite 0.42.0rc1__tar.gz → 0.43.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llvmlite might be problematic. Click here for more details.
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/PKG-INFO +1 -1
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/CMakeLists.txt +4 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/build.py +14 -7
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/core.cpp +14 -2
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/core.h +5 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/custom_passes.cpp +35 -4
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/orcjit.cpp +9 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/passmanagers.cpp +17 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/value.cpp +3 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/_version.py +2 -2
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/passmanagers.py +14 -7
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/test_binding.py +9 -6
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/test_refprune.py +31 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/LICENSE +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/README.rst +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/floatrep.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/ir_fpadd.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/ll_fpadd.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/lljit.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/llvmir.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/llvmir_iter.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/parseasm.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/sum.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/examples/test.ll +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/Makefile.freebsd +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/Makefile.linux +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/Makefile.osx +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/assembly.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/bitcode.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/dummy/CMakeLists.txt +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/dylib.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/executionengine.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/initfini.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/linker.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/memorymanager.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/memorymanager.h +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/module.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/object_file.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/targets.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/transforms.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/ffi/type.cpp +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/__init__.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/__init__.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/analysis.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/common.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/context.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/dylib.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/executionengine.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/ffi.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/initfini.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/linker.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/module.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/object_file.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/options.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/orcjit.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/targets.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/transforms.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/typeref.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/binding/value.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/__init__.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/_utils.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/builder.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/context.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/instructions.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/module.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/transforms.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/types.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/ir/values.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/__init__.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/__main__.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/customize.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/refprune_proto.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/test_ir.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/tests/test_valuerepr.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/llvmlite/utils.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/run_coverage.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/runtests.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/setup.py +0 -0
- {llvmlite-0.42.0rc1 → llvmlite-0.43.0}/versioneer.py +0 -0
|
@@ -11,6 +11,10 @@ if(NOT MSVC)
|
|
|
11
11
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -g")
|
|
12
12
|
endif()
|
|
13
13
|
|
|
14
|
+
# Work around llvm/llvm-project#83802 - LLVM's Findzstd.cmake uses variables
|
|
15
|
+
# that require including `GNUInstallDirs`, but it does not include it itself.
|
|
16
|
+
include(GNUInstallDirs)
|
|
17
|
+
|
|
14
18
|
find_package(LLVM REQUIRED CONFIG)
|
|
15
19
|
|
|
16
20
|
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
|
@@ -53,6 +53,13 @@ def run_llvm_config(llvm_config, args):
|
|
|
53
53
|
return out
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
def show_warning(message):
|
|
57
|
+
header = ' * '.join(("WARNING",) * 8)
|
|
58
|
+
blk = '=' * 80
|
|
59
|
+
warning = f'{blk}\n{header}\n{blk}'
|
|
60
|
+
print(f"{warning}\n{message}\n{warning}")
|
|
61
|
+
|
|
62
|
+
|
|
56
63
|
def find_windows_generator():
|
|
57
64
|
"""
|
|
58
65
|
Find a suitable cmake "generator" under Windows.
|
|
@@ -156,16 +163,16 @@ def main_posix(kind, library_ext):
|
|
|
156
163
|
"overridden.\nThis is unsupported behaviour, llvmlite may not "
|
|
157
164
|
"work as intended.\nRequested LLVM version: {}".format(
|
|
158
165
|
out.strip()))
|
|
159
|
-
|
|
160
|
-
blk = '=' * 80
|
|
161
|
-
warning = '{}\n{}\n{}'.format(blk, warn, blk)
|
|
162
|
-
print(warning)
|
|
163
|
-
print(msg)
|
|
164
|
-
print(warning + '\n')
|
|
166
|
+
show_warning(msg)
|
|
165
167
|
else:
|
|
166
168
|
(version, _) = out.split('.', 1)
|
|
167
169
|
version = int(version)
|
|
168
|
-
if version
|
|
170
|
+
if version == 15:
|
|
171
|
+
msg = ("Building with LLVM 15; note that LLVM 15 support is "
|
|
172
|
+
"presently experimental")
|
|
173
|
+
show_warning(msg)
|
|
174
|
+
elif version != 14:
|
|
175
|
+
|
|
169
176
|
msg = ("Building llvmlite requires LLVM 14, got "
|
|
170
177
|
"{!r}. Be sure to set LLVM_CONFIG to the right executable "
|
|
171
178
|
"path.\nRead the documentation at "
|
|
@@ -21,10 +21,22 @@ API_EXPORT(void)
|
|
|
21
21
|
LLVMPY_DisposeString(const char *msg) { free(const_cast<char *>(msg)); }
|
|
22
22
|
|
|
23
23
|
API_EXPORT(LLVMContextRef)
|
|
24
|
-
LLVMPY_GetGlobalContext() {
|
|
24
|
+
LLVMPY_GetGlobalContext() {
|
|
25
|
+
auto context = LLVMGetGlobalContext();
|
|
26
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
27
|
+
LLVMContextSetOpaquePointers(context, false);
|
|
28
|
+
#endif
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
25
31
|
|
|
26
32
|
API_EXPORT(LLVMContextRef)
|
|
27
|
-
LLVMPY_ContextCreate() {
|
|
33
|
+
LLVMPY_ContextCreate() {
|
|
34
|
+
LLVMContextRef context = LLVMContextCreate();
|
|
35
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
36
|
+
LLVMContextSetOpaquePointers(context, false);
|
|
37
|
+
#endif
|
|
38
|
+
return context;
|
|
39
|
+
}
|
|
28
40
|
|
|
29
41
|
API_EXPORT(void)
|
|
30
42
|
LLVMPY_ContextDispose(LLVMContextRef context) {
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
#define LLVMPY_CORE_H_
|
|
3
3
|
|
|
4
4
|
#include "llvm-c/Core.h"
|
|
5
|
+
|
|
6
|
+
// Needed for macros that control version-specific behaviour - included here so
|
|
7
|
+
// that they are available in all ffi translation units
|
|
8
|
+
#include "llvm/Config/llvm-config.h"
|
|
9
|
+
|
|
5
10
|
#include <cstdlib>
|
|
6
11
|
#include <cstring>
|
|
7
12
|
|
|
@@ -400,7 +400,8 @@ struct RefPrunePass : public FunctionPass {
|
|
|
400
400
|
SmallBBSet tail_nodes;
|
|
401
401
|
tail_nodes.insert(decref->getParent());
|
|
402
402
|
if (!verifyFanoutBackward(incref, incref->getParent(),
|
|
403
|
-
&tail_nodes))
|
|
403
|
+
&tail_nodes, false))
|
|
404
|
+
|
|
404
405
|
continue;
|
|
405
406
|
|
|
406
407
|
// scan the CFG between the incref and decref BBs, if
|
|
@@ -495,6 +496,29 @@ struct RefPrunePass : public FunctionPass {
|
|
|
495
496
|
* │ MORE CFG │
|
|
496
497
|
* └────────────┘
|
|
497
498
|
*
|
|
499
|
+
* a complex pattern about fanout-raise
|
|
500
|
+
* https://github.com/numba/llvmlite/issues/1023
|
|
501
|
+
* ┌────────────┐
|
|
502
|
+
* │ incref │
|
|
503
|
+
* │ incref │
|
|
504
|
+
* └────────────┘
|
|
505
|
+
* / \
|
|
506
|
+
* / \
|
|
507
|
+
* ┌────────────┐ \
|
|
508
|
+
* │ decref | \
|
|
509
|
+
* └────────────┘ \
|
|
510
|
+
* / \ \
|
|
511
|
+
* / \ \
|
|
512
|
+
* ┌────────────┐ ┌────────────┐ \
|
|
513
|
+
* │ decref | │ incref | \
|
|
514
|
+
* └────────────┘ └────────────┘ \
|
|
515
|
+
* / \ \
|
|
516
|
+
* / \ \
|
|
517
|
+
* ┌────────────┐ ┌────────────┐
|
|
518
|
+
* │ decref | │ raise |
|
|
519
|
+
* │ decref | └────────────┘
|
|
520
|
+
* └────────────┘
|
|
521
|
+
*
|
|
498
522
|
* Parameters:
|
|
499
523
|
* - F a Function
|
|
500
524
|
* - prune_raise_exit, if false case 1 is considered, if true case 2 is
|
|
@@ -648,10 +672,12 @@ struct RefPrunePass : public FunctionPass {
|
|
|
648
672
|
for (BasicBlock *bb : *decref_blocks) {
|
|
649
673
|
raising_blocks.insert(bb);
|
|
650
674
|
}
|
|
651
|
-
if (verifyFanoutBackward(incref, head_node, p_raising_blocks
|
|
675
|
+
if (verifyFanoutBackward(incref, head_node, p_raising_blocks,
|
|
676
|
+
prune_raise_exit))
|
|
652
677
|
return true;
|
|
653
678
|
|
|
654
|
-
} else if (verifyFanoutBackward(incref, head_node, decref_blocks
|
|
679
|
+
} else if (verifyFanoutBackward(incref, head_node, decref_blocks,
|
|
680
|
+
prune_raise_exit)) {
|
|
655
681
|
return true;
|
|
656
682
|
}
|
|
657
683
|
}
|
|
@@ -844,7 +870,8 @@ struct RefPrunePass : public FunctionPass {
|
|
|
844
870
|
*
|
|
845
871
|
*/
|
|
846
872
|
bool verifyFanoutBackward(CallInst *incref, BasicBlock *head_node,
|
|
847
|
-
const SmallBBSet *tail_nodes
|
|
873
|
+
const SmallBBSet *tail_nodes,
|
|
874
|
+
bool prune_raise_exit) {
|
|
848
875
|
// push the tail nodes into a work list
|
|
849
876
|
SmallVector<BasicBlock *, 10> todo;
|
|
850
877
|
for (BasicBlock *bb : *tail_nodes) {
|
|
@@ -864,6 +891,10 @@ struct RefPrunePass : public FunctionPass {
|
|
|
864
891
|
while (workstack.size() > 0) {
|
|
865
892
|
// Get a basic block
|
|
866
893
|
BasicBlock *cur_node = workstack.pop_back_val();
|
|
894
|
+
// If cur_node is a raising block, then skip it
|
|
895
|
+
if (prune_raise_exit && isRaising(cur_node)) {
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
867
898
|
// if the block has been seen before then skip
|
|
868
899
|
if (visited.count(cur_node)) {
|
|
869
900
|
// Already visited
|
|
@@ -158,7 +158,12 @@ LLVMPY_LLJITLookup(std::shared_ptr<LLJIT> *lljit, const char *dylib_name,
|
|
|
158
158
|
return nullptr;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
162
|
+
*addr = sym->getValue();
|
|
163
|
+
#else
|
|
161
164
|
*addr = sym->getAddress();
|
|
165
|
+
#endif
|
|
166
|
+
|
|
162
167
|
return new JITDylibTracker(*lljit, *dylib,
|
|
163
168
|
std::move(dylib->createResourceTracker()));
|
|
164
169
|
}
|
|
@@ -334,7 +339,11 @@ LLVMPY_LLJIT_Link(std::shared_ptr<LLJIT> *lljit, const char *libraryName,
|
|
|
334
339
|
LLVMDisposeErrorMessage(message);
|
|
335
340
|
return nullptr;
|
|
336
341
|
}
|
|
342
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
343
|
+
exports[export_idx].address = lookup->getValue();
|
|
344
|
+
#else
|
|
337
345
|
exports[export_idx].address = lookup->getAddress();
|
|
346
|
+
#endif
|
|
338
347
|
}
|
|
339
348
|
return new JITDylibTracker(*lljit, *dylib,
|
|
340
349
|
std::move(dylib->getDefaultResourceTracker()));
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
#include <llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h>
|
|
40
40
|
#include <llvm/Transforms/IPO.h>
|
|
41
41
|
#include <llvm/Transforms/IPO/AlwaysInliner.h>
|
|
42
|
+
#include <llvm/Transforms/Scalar/SimpleLoopUnswitch.h>
|
|
42
43
|
#include <llvm/Transforms/Utils.h>
|
|
43
44
|
#include <llvm/Transforms/Utils/UnifyFunctionExitNodes.h>
|
|
44
45
|
using namespace llvm;
|
|
@@ -161,8 +162,13 @@ LLVMPY_AddCallGraphDOTPrinterPass(LLVMPassManagerRef PM) {
|
|
|
161
162
|
|
|
162
163
|
API_EXPORT(void)
|
|
163
164
|
LLVMPY_AddDotDomPrinterPass(LLVMPassManagerRef PM, bool showBody) {
|
|
165
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
166
|
+
unwrap(PM)->add(showBody ? llvm::createDomPrinterWrapperPassPass()
|
|
167
|
+
: llvm::createDomOnlyPrinterWrapperPassPass());
|
|
168
|
+
#else
|
|
164
169
|
unwrap(PM)->add(showBody ? llvm::createDomPrinterPass()
|
|
165
170
|
: llvm::createDomOnlyPrinterPass());
|
|
171
|
+
#endif
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
API_EXPORT(void)
|
|
@@ -172,8 +178,13 @@ LLVMPY_AddGlobalsModRefAAPass(LLVMPassManagerRef PM) {
|
|
|
172
178
|
|
|
173
179
|
API_EXPORT(void)
|
|
174
180
|
LLVMPY_AddDotPostDomPrinterPass(LLVMPassManagerRef PM, bool showBody) {
|
|
181
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
182
|
+
unwrap(PM)->add(showBody ? llvm::createPostDomPrinterWrapperPassPass()
|
|
183
|
+
: llvm::createPostDomOnlyPrinterWrapperPassPass());
|
|
184
|
+
#else
|
|
175
185
|
unwrap(PM)->add(showBody ? llvm::createPostDomPrinterPass()
|
|
176
186
|
: llvm::createPostDomOnlyPrinterPass());
|
|
187
|
+
#endif
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
API_EXPORT(void)
|
|
@@ -244,10 +255,12 @@ LLVMPY_AddAlwaysInlinerPass(LLVMPassManagerRef PM, bool insertLifetime) {
|
|
|
244
255
|
unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass(insertLifetime));
|
|
245
256
|
}
|
|
246
257
|
|
|
258
|
+
#if LLVM_VERSION_MAJOR < 15
|
|
247
259
|
API_EXPORT(void)
|
|
248
260
|
LLVMPY_AddArgPromotionPass(LLVMPassManagerRef PM, unsigned int maxElements) {
|
|
249
261
|
unwrap(PM)->add(llvm::createArgumentPromotionPass(maxElements));
|
|
250
262
|
}
|
|
263
|
+
#endif
|
|
251
264
|
|
|
252
265
|
API_EXPORT(void)
|
|
253
266
|
LLVMPY_AddBreakCriticalEdgesPass(LLVMPassManagerRef PM) {
|
|
@@ -336,8 +349,12 @@ LLVMPY_AddLoopUnrollAndJamPass(LLVMPassManagerRef PM) {
|
|
|
336
349
|
API_EXPORT(void)
|
|
337
350
|
LLVMPY_AddLoopUnswitchPass(LLVMPassManagerRef PM, bool optimizeForSize,
|
|
338
351
|
bool hasBranchDivergence) {
|
|
352
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
353
|
+
unwrap(PM)->add(createSimpleLoopUnswitchLegacyPass(optimizeForSize));
|
|
354
|
+
#else
|
|
339
355
|
unwrap(PM)->add(
|
|
340
356
|
createLoopUnswitchPass(optimizeForSize, hasBranchDivergence));
|
|
357
|
+
#endif
|
|
341
358
|
}
|
|
342
359
|
|
|
343
360
|
API_EXPORT(void)
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
// the following is needed for WriteGraph()
|
|
8
8
|
#include "llvm/Analysis/CFGPrinter.h"
|
|
9
|
+
#if LLVM_VERSION_MAJOR > 14
|
|
10
|
+
#include "llvm/Support/GraphWriter.h"
|
|
11
|
+
#endif
|
|
9
12
|
|
|
10
13
|
/* An iterator around a attribute list, including the stop condition */
|
|
11
14
|
struct AttributeListIterator {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# unpacked source archive. Distribution tarballs contain a pre-generated copy
|
|
5
5
|
# of this file.
|
|
6
6
|
|
|
7
|
-
version_version = '0.
|
|
8
|
-
version_full = '
|
|
7
|
+
version_version = '0.43.0'
|
|
8
|
+
version_full = '6c786059354260a0ae93f9d0144d4016ab3d63b4'
|
|
9
9
|
def get_versions(default={}, verbose=False):
|
|
10
10
|
return {'version': version_version, 'full': version_full}
|
|
11
11
|
|
|
@@ -3,6 +3,7 @@ from ctypes import (c_bool, c_char_p, c_int, c_size_t, c_uint, Structure, byref,
|
|
|
3
3
|
from collections import namedtuple
|
|
4
4
|
from enum import IntFlag
|
|
5
5
|
from llvmlite.binding import ffi
|
|
6
|
+
from llvmlite.binding.initfini import llvm_version_info
|
|
6
7
|
import os
|
|
7
8
|
from tempfile import mkstemp
|
|
8
9
|
from llvmlite.binding.common import _encode_string
|
|
@@ -10,6 +11,8 @@ from llvmlite.binding.common import _encode_string
|
|
|
10
11
|
_prunestats = namedtuple('PruneStats',
|
|
11
12
|
('basicblock diamond fanout fanout_raise'))
|
|
12
13
|
|
|
14
|
+
llvm_version_major = llvm_version_info[0]
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
class PruneStats(_prunestats):
|
|
15
18
|
""" Holds statistics from reference count pruning.
|
|
@@ -258,6 +261,8 @@ class PassManager(ffi.ObjectRef):
|
|
|
258
261
|
|
|
259
262
|
LLVM 14: `llvm::createArgumentPromotionPass`
|
|
260
263
|
""" # noqa E501
|
|
264
|
+
if llvm_version_major > 14:
|
|
265
|
+
raise RuntimeError('ArgumentPromotionPass unavailable in LLVM > 14')
|
|
261
266
|
ffi.lib.LLVMPY_AddArgPromotionPass(self, max_elements)
|
|
262
267
|
|
|
263
268
|
def add_break_critical_edges_pass(self):
|
|
@@ -466,9 +471,9 @@ class PassManager(ffi.ObjectRef):
|
|
|
466
471
|
See https://llvm.org/docs/Passes.html#loop-unswitch-unswitch-loops
|
|
467
472
|
|
|
468
473
|
LLVM 14: `llvm::createLoopUnswitchPass`
|
|
474
|
+
LLVM 15: `llvm::createSimpleLoopUnswitchLegacyPass`
|
|
469
475
|
""" # noqa E501
|
|
470
|
-
ffi.lib.LLVMPY_AddLoopUnswitchPass(self,
|
|
471
|
-
optimize_for_size,
|
|
476
|
+
ffi.lib.LLVMPY_AddLoopUnswitchPass(self, optimize_for_size,
|
|
472
477
|
has_branch_divergence)
|
|
473
478
|
|
|
474
479
|
def add_lower_atomic_pass(self):
|
|
@@ -866,7 +871,11 @@ ffi.lib.LLVMPY_AddRegionInfoPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
|
866
871
|
ffi.lib.LLVMPY_AddScalarEvolutionAAPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
867
872
|
ffi.lib.LLVMPY_AddAggressiveDCEPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
868
873
|
ffi.lib.LLVMPY_AddAlwaysInlinerPass.argtypes = [ffi.LLVMPassManagerRef, c_bool]
|
|
869
|
-
|
|
874
|
+
|
|
875
|
+
if llvm_version_major < 15:
|
|
876
|
+
ffi.lib.LLVMPY_AddArgPromotionPass.argtypes = [
|
|
877
|
+
ffi.LLVMPassManagerRef, c_uint]
|
|
878
|
+
|
|
870
879
|
ffi.lib.LLVMPY_AddBreakCriticalEdgesPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
871
880
|
ffi.lib.LLVMPY_AddDeadStoreEliminationPass.argtypes = [
|
|
872
881
|
ffi.LLVMPassManagerRef]
|
|
@@ -883,10 +892,8 @@ ffi.lib.LLVMPY_AddLoopStrengthReducePass.argtypes = [ffi.LLVMPassManagerRef]
|
|
|
883
892
|
ffi.lib.LLVMPY_AddLoopSimplificationPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
884
893
|
ffi.lib.LLVMPY_AddLoopUnrollPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
885
894
|
ffi.lib.LLVMPY_AddLoopUnrollAndJamPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
886
|
-
ffi.lib.LLVMPY_AddLoopUnswitchPass.argtypes = [
|
|
887
|
-
|
|
888
|
-
c_bool,
|
|
889
|
-
c_bool]
|
|
895
|
+
ffi.lib.LLVMPY_AddLoopUnswitchPass.argtypes = [ffi.LLVMPassManagerRef, c_bool,
|
|
896
|
+
c_bool]
|
|
890
897
|
ffi.lib.LLVMPY_AddLowerAtomicPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
891
898
|
ffi.lib.LLVMPY_AddLowerInvokePass.argtypes = [ffi.LLVMPassManagerRef]
|
|
892
899
|
ffi.lib.LLVMPY_AddLowerSwitchPass.argtypes = [ffi.LLVMPassManagerRef]
|
|
@@ -18,6 +18,7 @@ from llvmlite import binding as llvm
|
|
|
18
18
|
from llvmlite.binding import ffi
|
|
19
19
|
from llvmlite.tests import TestCase
|
|
20
20
|
|
|
21
|
+
llvm_version_major = llvm.llvm_version_info[0]
|
|
21
22
|
|
|
22
23
|
# arvm7l needs extra ABI symbols to link successfully
|
|
23
24
|
if platform.machine() == 'armv7l':
|
|
@@ -653,7 +654,7 @@ class TestRISCVABI(BaseTest):
|
|
|
653
654
|
def test_rv32d_ilp32(self):
|
|
654
655
|
self.check_riscv_target()
|
|
655
656
|
llmod = self.fpadd_ll_module()
|
|
656
|
-
target = self.riscv_target_machine(features="+f,+d")
|
|
657
|
+
target = self.riscv_target_machine(features="+f,+d", abiname="ilp32")
|
|
657
658
|
self.assertEqual(self.break_up_asm(target.emit_assembly(llmod)),
|
|
658
659
|
riscv_asm_ilp32)
|
|
659
660
|
|
|
@@ -786,9 +787,9 @@ class TestMisc(BaseTest):
|
|
|
786
787
|
def test_version(self):
|
|
787
788
|
major, minor, patch = llvm.llvm_version_info
|
|
788
789
|
# one of these can be valid
|
|
789
|
-
valid =
|
|
790
|
-
self.assertIn(
|
|
791
|
-
self.assertIn(patch, range(
|
|
790
|
+
valid = (14, 15)
|
|
791
|
+
self.assertIn(major, valid)
|
|
792
|
+
self.assertIn(patch, range(8))
|
|
792
793
|
|
|
793
794
|
def test_check_jit_execution(self):
|
|
794
795
|
llvm.check_jit_execution()
|
|
@@ -2176,7 +2177,8 @@ class TestPasses(BaseTest, PassManagerTestMixin):
|
|
|
2176
2177
|
pm.add_aggressive_dead_code_elimination_pass()
|
|
2177
2178
|
pm.add_aa_eval_pass()
|
|
2178
2179
|
pm.add_always_inliner_pass()
|
|
2179
|
-
|
|
2180
|
+
if llvm_version_major < 15:
|
|
2181
|
+
pm.add_arg_promotion_pass(42)
|
|
2180
2182
|
pm.add_break_critical_edges_pass()
|
|
2181
2183
|
pm.add_dead_store_elimination_pass()
|
|
2182
2184
|
pm.add_reverse_post_order_function_attrs_pass()
|
|
@@ -2191,7 +2193,8 @@ class TestPasses(BaseTest, PassManagerTestMixin):
|
|
|
2191
2193
|
pm.add_loop_simplification_pass()
|
|
2192
2194
|
pm.add_loop_unroll_pass()
|
|
2193
2195
|
pm.add_loop_unroll_and_jam_pass()
|
|
2194
|
-
|
|
2196
|
+
if llvm_version_major < 15:
|
|
2197
|
+
pm.add_loop_unswitch_pass()
|
|
2195
2198
|
pm.add_lower_atomic_pass()
|
|
2196
2199
|
pm.add_lower_invoke_pass()
|
|
2197
2200
|
pm.add_lower_switch_pass()
|
|
@@ -521,6 +521,37 @@ common.ret:
|
|
|
521
521
|
mod, stats = self.check(self.fanout_raise_5)
|
|
522
522
|
self.assertEqual(stats.fanout_raise, 2)
|
|
523
523
|
|
|
524
|
+
# test case 6 is from https://github.com/numba/llvmlite/issues/1023
|
|
525
|
+
fanout_raise_6 = r"""
|
|
526
|
+
define i32 @main(i8* %ptr, i1 %cond1, i1 %cond2, i1 %cond3, i8** %excinfo) {
|
|
527
|
+
bb_A:
|
|
528
|
+
call void @NRT_incref(i8* %ptr)
|
|
529
|
+
call void @NRT_incref(i8* %ptr)
|
|
530
|
+
br i1 %cond1, label %bb_B, label %bb_C
|
|
531
|
+
bb_B:
|
|
532
|
+
call void @NRT_decref(i8* %ptr)
|
|
533
|
+
br i1 %cond2, label %bb_D, label %bb_E
|
|
534
|
+
bb_C:
|
|
535
|
+
store i8* null, i8** %excinfo, !numba_exception_output !0
|
|
536
|
+
ret i32 1
|
|
537
|
+
bb_D:
|
|
538
|
+
call void @NRT_decref(i8* %ptr)
|
|
539
|
+
ret i32 0
|
|
540
|
+
bb_E:
|
|
541
|
+
call void @NRT_incref(i8* %ptr)
|
|
542
|
+
br i1 %cond3, label %bb_F, label %bb_C
|
|
543
|
+
bb_F:
|
|
544
|
+
call void @NRT_decref(i8* %ptr)
|
|
545
|
+
call void @NRT_decref(i8* %ptr)
|
|
546
|
+
ret i32 0
|
|
547
|
+
}
|
|
548
|
+
!0 = !{i1 1}
|
|
549
|
+
"""
|
|
550
|
+
|
|
551
|
+
def test_fanout_raise_6(self):
|
|
552
|
+
mod, stats = self.check(self.fanout_raise_6)
|
|
553
|
+
self.assertEqual(stats.fanout_raise, 7)
|
|
554
|
+
|
|
524
555
|
|
|
525
556
|
if __name__ == '__main__':
|
|
526
557
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|