Skip to content

Instantly share code, notes, and snippets.

@guilhermeleobas
Created January 28, 2022 16:03
Show Gist options
  • Select an option

  • Save guilhermeleobas/d74b01c73f5eb3060a6bc844f7240155 to your computer and use it in GitHub Desktop.

Select an option

Save guilhermeleobas/d74b01c73f5eb3060a6bc844f7240155 to your computer and use it in GitHub Desktop.
#### without DCE
(Pdb++) func_ir.dump()
label 0:
x = arg(0, name=x) ['x']
m = arg(1, name=m) ['m']
y = arg(2, name=y) ['y']
$2load_global.0 = global(len: <built-in function len>) ['$2load_global.0']
sz = call $2load_global.0(x, func=$2load_global.0, args=[Var(x, test_omnisci_column_basic.py:832)], kws=(), vararg=None, target=None) ['$2load_global.0', 'sz', 'x']
$10load_global.3 = global(range: <class 'range'>) ['$10load_global.3']
$14call_function.5 = call $10load_global.3(sz, func=$10load_global.3, args=[Var(sz, test_omnisci_column_basic.py:832)], kws=(), vararg=None, target=None) ['$10load_global.3', '$14call_function.5', 'sz']
$16get_iter.6 = getiter(value=$14call_function.5) ['$14call_function.5', '$16get_iter.6']
$phi18.0 = $16get_iter.6 ['$16get_iter.6', '$phi18.0']
jump 18 []
label 18:
$18for_iter.1 = iternext(value=$phi18.0) ['$18for_iter.1', '$phi18.0']
$18for_iter.2 = pair_first(value=$18for_iter.1) ['$18for_iter.1', '$18for_iter.2']
$18for_iter.3 = pair_second(value=$18for_iter.1) ['$18for_iter.1', '$18for_iter.3']
$phi20.1 = $18for_iter.2 ['$18for_iter.2', '$phi20.1']
branch $18for_iter.3, 20, 120 ['$18for_iter.3']
label 20:
i = $phi20.1 ['$phi20.1', 'i']
$24load_attr.3 = getattr(value=x, attr=dtype) ['$24load_attr.3', 'x']
$26load_deref.4 = freevar(types: <module 'numba.types' from '/home/guilhermeleobas/miniconda3/envs/rbc/lib/python3.10/site-packages/numba/types/__init__.py'>) ['$26load_deref.4']
$28load_attr.5 = getattr(value=$26load_deref.4, attr=int32) ['$26load_deref.4', '$28load_attr.5']
$30compare_op.6 = const(bool, True) ['$30compare_op.6']
bool32 = global(bool: <class 'bool'>) ['bool32']
$32pred = call bool32($30compare_op.6, func=bool32, args=(Var($30compare_op.6, test_omnisci_column_basic.py:834),), kws=(), vararg=None, target=None) ['$30compare_op.6', '$32pred', 'bool32']
branch $32pred, 34, 44 ['$32pred']
label 34:
$const34.1 = const(int, 1) ['$const34.1']
y[i] = $const34.1 ['$const34.1', 'i', 'y']
jump 121 []
label 44:
$46load_attr.2 = getattr(value=x, attr=dtype) ['$46load_attr.2', 'x']
$48load_deref.3 = freevar(types: <module 'numba.types' from '/home/guilhermeleobas/miniconda3/envs/rbc/lib/python3.10/site-packages/numba/types/__init__.py'>) ['$48load_deref.3']
$50load_attr.4 = getattr(value=$48load_deref.3, attr=int64) ['$48load_deref.3', '$50load_attr.4']
$52compare_op.5 = const(bool, False) ['$52compare_op.5']
bool54 = global(bool: <class 'bool'>) ['bool54']
$54pred = call bool54($52compare_op.5, func=bool54, args=(Var($52compare_op.5, test_omnisci_column_basic.py:836),), kws=(), vararg=None, target=None) ['$52compare_op.5', '$54pred', 'bool54']
branch $54pred, 56, 66 ['$54pred']
label 56:
$const56.1 = const(int, 2) ['$const56.1']
y[i] = $const56.1 ['$const56.1', 'i', 'y']
jump 121 []
label 66:
$68load_attr.2 = getattr(value=x, attr=dtype) ['$68load_attr.2', 'x']
$70load_deref.3 = freevar(types: <module 'numba.types' from '/home/guilhermeleobas/miniconda3/envs/rbc/lib/python3.10/site-packages/numba/types/__init__.py'>) ['$70load_deref.3']
$72load_attr.4 = getattr(value=$70load_deref.3, attr=float32) ['$70load_deref.3', '$72load_attr.4']
$74compare_op.5 = const(bool, False) ['$74compare_op.5']
bool76 = global(bool: <class 'bool'>) ['bool76']
$76pred = call bool76($74compare_op.5, func=bool76, args=(Var($74compare_op.5, test_omnisci_column_basic.py:838),), kws=(), vararg=None, target=None) ['$74compare_op.5', '$76pred', 'bool76']
branch $76pred, 78, 88 ['$76pred']
label 78:
$const78.1 = const(float, 3.0) ['$const78.1']
y[i] = $const78.1 ['$const78.1', 'i', 'y']
jump 121 []
label 88:
$90load_attr.2 = getattr(value=x, attr=dtype) ['$90load_attr.2', 'x']
$92load_deref.3 = freevar(types: <module 'numba.types' from '/home/guilhermeleobas/miniconda3/envs/rbc/lib/python3.10/site-packages/numba/types/__init__.py'>) ['$92load_deref.3']
$94load_attr.4 = getattr(value=$92load_deref.3, attr=float64) ['$92load_deref.3', '$94load_attr.4']
$96compare_op.5 = const(bool, False) ['$96compare_op.5']
bool98 = global(bool: <class 'bool'>) ['bool98']
$98pred = call bool98($96compare_op.5, func=bool98, args=(Var($96compare_op.5, test_omnisci_column_basic.py:840),), kws=(), vararg=None, target=None) ['$96compare_op.5', '$98pred', 'bool98']
branch $98pred, 100, 110 ['$98pred']
label 100:
$const100.1 = const(float, 4.0) ['$const100.1']
y[i] = $const100.1 ['$const100.1', 'i', 'y']
jump 121 []
label 110:
$const110.1 = const(str, hello world) ['$const110.1']
y[i] = $const110.1 ['$const110.1', 'i', 'y']
jump 121 []
label 120:
$122return_value.1 = cast(value=sz) ['$122return_value.1', 'sz']
return $122return_value.1 ['$122return_value.1']
label 121:
jump 18 []
####### with DCE
(Pdb++) func_ir.dump()
label 0:
x = arg(0, name=x) ['x']
y = arg(2, name=y) ['y']
$2load_global.0 = global(len: <built-in function len>) ['$2load_global.0']
sz = call $2load_global.0(x, func=$2load_global.0, args=[Var(x, test_omnisci_column_basic.py:832)], kws=(), vararg=None, target=None) ['$2load_global.0', 'sz', 'x']
$10load_global.3 = global(range: <class 'range'>) ['$10load_global.3']
$14call_function.5 = call $10load_global.3(sz, func=$10load_global.3, args=[Var(sz, test_omnisci_column_basic.py:832)], kws=(), vararg=None, target=None) ['$10load_global.3', '$14call_function.5', 'sz']
$16get_iter.6 = getiter(value=$14call_function.5) ['$14call_function.5', '$16get_iter.6']
$phi18.0 = $16get_iter.6 ['$16get_iter.6', '$phi18.0']
jump 18 []
label 18:
$18for_iter.1 = iternext(value=$phi18.0) ['$18for_iter.1', '$phi18.0']
$18for_iter.2 = pair_first(value=$18for_iter.1) ['$18for_iter.1', '$18for_iter.2']
$18for_iter.3 = pair_second(value=$18for_iter.1) ['$18for_iter.1', '$18for_iter.3']
$phi20.1 = $18for_iter.2 ['$18for_iter.2', '$phi20.1']
branch $18for_iter.3, 20, 120 ['$18for_iter.3']
label 20:
i = $phi20.1 ['$phi20.1', 'i']
$30compare_op.6 = const(bool, True) ['$30compare_op.6']
bool32 = global(bool: <class 'bool'>) ['bool32']
$32pred = call bool32($30compare_op.6, func=bool32, args=(Var($30compare_op.6, test_omnisci_column_basic.py:834),), kws=(), vararg=None, target=None) ['$30compare_op.6', '$32pred', 'bool32']
jump 34 []
label 34:
$const34.1 = const(int, 1) ['$const34.1']
y[i] = $const34.1 ['$const34.1', 'i', 'y']
jump 121 []
label 120:
$122return_value.1 = cast(value=sz) ['$122return_value.1', 'sz']
return $122return_value.1 ['$122return_value.1']
label 121:
jump 18 []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment