def _simplify_conditionally_defined_variable(self, func_ir):
        """
        Rewrite assignments like:

            ver1 = null()
            ...
            ver1 = ver
            ...
            uses(ver1)

        into:
            # delete all assignments to ver1
            uses(ver)

        This is only needed for parfors because the SSA pass will create extra
        variable assignments that the parfor code does not expect.
        This pass helps avoid problems by reverting the effect of SSA.
        """
        any_block = next(iter(func_ir.blocks.values()))
        scope = any_block.scope
        defs = func_ir._definitions

        def unver_or_undef(unver, defn):
            # Is the definition undefined or pointing to the unversioned name?
            if isinstance(defn, ir.Var):
                if defn.unversioned_name == unver:
                    return True
            elif isinstance(defn, ir.Expr):
                if defn.op == "null":
                    return True
            return False

        def legalize_all_versioned_names(var):
            # Are all versioned names undefined or defined to the same
            # variable chain?
            if not var.versioned_names:
                return False
            for versioned in var.versioned_names:
                vs = defs.get(versioned, ())
                if not all(map(partial(unver_or_undef, k), vs)):
                    return False
            return True

        # Find unversioned variables that met the conditions
        suspects = set()
        for k in defs:
            try:
                # This may fail?
                var = scope.get_exact(k)
            except errors.NotDefinedError:
                continue
            # is the var name unversioned?
            if var.unversioned_name == k:
                if legalize_all_versioned_names(var):
                    suspects.add(var)

        delete_set = set()
        replace_map = {}
        for var in suspects:
            # rewrite Var uses to the unversioned name
            for versioned in var.versioned_names:
                ver_var = scope.get_exact(versioned)
                # delete assignment to the versioned name
                delete_set.add(ver_var)
                # replace references to versioned name with the unversioned
                replace_map[versioned] = var

        # remove assignments to the versioned names
        for _label, blk in func_ir.blocks.items():
            for assign in blk.find_insts(ir.Assign):
                if assign.target in delete_set:
                    blk.remove(assign)
        # do variable replacement
        replace_vars(func_ir.blocks, replace_map)

        Rewrite assignments like:

            ver1 = null()
            ...
            ver1 = ver
            ...
            uses(ver1)

        into:
            # delete all assignments to ver1
            uses(ver)

        This is only needed for parfors because the SSA pass will create extra
        variable assignments that the parfor code does not expect.
        This pass helps avoid problems by reverting the effect of SSA.
        
numba/core/typed_passes.py