LLVM IR parsing error
See original GitHub issueAs reported in numba/numba#2158, @cgohlke saw an LLVM IR parse error in Numba 0.29 / llvmlite 0.14.0:
X:\Python35\lib\site-packages\numba\targets\codegen.py in add_ir_module(self, ir_module)
    147         assert isinstance(ir_module, llvmir.Module)
    148         ir = cgutils.normalize_ir_text(str(ir_module))
--> 149         ll_module = ll.parse_assembly(ir)
    150         ll_module.name = ir_module.name
    151         ll_module.verify()
X:\Python35\lib\site-packages\llvmlite\binding\module.py in parse_assembly(llvmir)
     20         if errmsg:
     21             mod.close()
---> 22             raise RuntimeError("LLVM IR parsing error\n{0}".format(errmsg))
     23     return mod
     24 
RuntimeError: Failed at object (object mode frontend)
Failed at object (object mode backend)
LLVM IR parsing error
<string>:767:55: error: expected type
  %".600" = call i8* (i64) @"PyLong_FromSsize_t"(i64 (0, 0))
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
LLVM IR parsing error in a large function · Issue #3666 - GitHub
I created the environment by conda create -n numba-env python numba . Numba 0.42.0; Python 3.7.2; llvmlite 0.27.0. This code creates the ...
Read more >numpy - Numba "LLVM IR parsing error" seemingly because ...
Numba encounters "LLVM IR parsing error" in my code seemingly due to defualt typing of np.complex128.shape, but I could not find any ...
Read more >LLVM Language Reference Manual
Abstract¶. This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides ......
Read more >[llvm-dev] Parse LLVM IR - Mailing Lists
Hello, I am a newbie to LLVM and right now I am on the hook to parse some IR code and do some...
Read more >MIRParser Class Reference - LLVM
Parses the optional LLVM IR module in the MIR file. A new, empty module is created if the LLVM IR isn't present. Returns:...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Hi I encounter the same issue, when I pass a list which’s length is 1. Here is my code:
F1Optimizer.maximize_expectation([0.3])This is the error information:
RuntimeError Traceback (most recent call last) <ipython-input-15-b3677380eb6c> in <module>() ----> 1 F1Optimizer.maximize_expectation([0.3])
/root/anaconda3/lib/python3.6/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 305 argtypes.append(self.typeof_pyval(a)) 306 try: –> 307 return self.compile(tuple(argtypes)) 308 except errors.TypingError as e: 309 # Intercept typing error that may be due to an argument
/root/anaconda3/lib/python3.6/site-packages/numba/dispatcher.py in compile(self, sig) 656 flags=flags, locals=self.locals, 657 lifted=(), –> 658 lifted_from=self.lifted_from) 659 660 # Check typing error if object mode is used
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, library) 752 args, return_type, flags, locals) 753 return pipeline.compile_ir(func_ir=func_ir, lifted=lifted, –> 754 lifted_from=lifted_from) 755 756
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in compile_ir(self, func_ir, lifted, lifted_from) 366 367 self._set_and_check_ir(func_ir) –> 368 return self._compile_ir() 369 370 def stage_analyze_bytecode(self):
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in _compile_ir(self) 704 “”" 705 assert self.func_ir is not None –> 706 return self._compile_core() 707 708
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in _compile_core(self) 684 685 pm.finalize() –> 686 res = pm.run(self.status) 687 if res is not None: 688 # Early pipeline completion
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in run(self, status) 244 # No more fallback pipelines? 245 if is_final_pipeline: –> 246 raise patched_exception 247 # Go to next fallback pipeline 248 else:
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in run(self, status) 236 try: 237 event(stage_name) –> 238 stage() 239 except _EarlyPipelineCompletion as e: 240 return e.result
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in stage_objectmode_backend(self) 597 “”" 598 lowerfn = self.backend_object_mode –> 599 self._backend(lowerfn, objectmode=True) 600 601 # Warn if compiled function in object mode and force_pyobject not set
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in _backend(self, lowerfn, objectmode) 574 self.library.enable_object_caching() 575 –> 576 lowered = lowerfn() 577 signature = typing.signature(self.return_type, *self.args) 578 self.cr = compile_result(typing_context=self.typingctx,
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in backend_object_mode(self) 548 self.library, 549 self.func_ir, –> 550 self.flags) 551 552 def backend_nopython_mode(self):
/root/anaconda3/lib/python3.6/site-packages/numba/compiler.py in py_lowering_stage(targetctx, library, interp, flags) 880 fndesc = funcdesc.PythonFunctionDescriptor.from_object_mode_function(interp) 881 lower = objmode.PyLower(targetctx, library, fndesc, interp) –> 882 lower.lower() 883 if not flags.no_cpython_wrapper: 884 lower.create_cpython_wrapper()
/root/anaconda3/lib/python3.6/site-packages/numba/lowering.py in lower(self) 158 159 # Materialize LLVM Module –> 160 self.library.add_ir_module(self.module) 161 162 def extract_function_arguments(self):
/root/anaconda3/lib/python3.6/site-packages/numba/targets/codegen.py in add_ir_module(self, ir_module) 183 ir = cgutils.normalize_ir_text(str(ir_module)) 184 with llvmts.lock_llvm: –> 185 ll_module = llvmts.parse_assembly(ir) 186 ll_module.name = ir_module.name 187 ll_module.verify()
/root/anaconda3/lib/python3.6/site-packages/numba/llvmthreadsafe.py in wrapped(*args, **kwargs) 28 def wrapped(*args, **kwargs): 29 with self: —> 30 return fn(*args, **kwargs) 31 return wrapped 32
/root/anaconda3/lib/python3.6/site-packages/numba/llvmthreadsafe.py in wrapper(*args, **kwargs) 57 @functools.wraps(fn) 58 def wrapper(*args, **kwargs): —> 59 return _patch_dispose(fn(*args, **kwargs)) 60 return wrapper 61
/root/anaconda3/lib/python3.6/site-packages/llvmlite/binding/module.py in parse_assembly(llvmir) 20 if errmsg: 21 mod.close() —> 22 raise RuntimeError(“LLVM IR parsing error\n{0}”.format(errmsg)) 23 return mod 24
RuntimeError: Failed at object (object mode backend) LLVM IR parsing error <string>:1257:48: error: expected value token %“.845” = call i8* @“PyLong_FromSsize_t”(i64 slice(None, None, -1)) ^
However, when I pass [0.3,02] to the function, it works perfectly fine. Did I miss something?
I’m closing this as the reproducer here https://github.com/numba/llvmlite/issues/218#issuecomment-257287340 no longer has problems. Further https://github.com/numba/llvmlite/issues/218#issuecomment-319007108 also works fine (Numba 0.40, llvmlite 0.25) .