'testcase from #2350'

def test_refct_pruning_with_branches(self):

    @njit
    def _append_non_na(x, y, agg, field):
        if (not np.isnan(field)):
            agg[(y, x)] += 1
    @njit
    def _append(x, y, agg, field):
        if (not np.isnan(field)):
            if np.isnan(agg[(y, x)]):
                agg[(y, x)] = field
            else:
                agg[(y, x)] += field
    @njit
    def append(x, y, agg, field):
        _append_non_na(x, y, agg, field)
        _append(x, y, agg, field)
    @njit(no_cpython_wrapper=True)
    def extend(arr, field):
        for i in range(arr.shape[0]):
            for j in range(arr.shape[1]):
                append(j, i, arr, field)
    extend.compile('(f4[:,::1],    f4)')
    llvmir = str(extend.inspect_llvm(extend.signatures[0]))
    refops = list(re.finditer('(NRT_incref|NRT_decref)\\([^\\)]+\\)', llvmir))
    self.assertEqual(len(refops), 0)
