def check_index(stmt_index,
                    array_accessed,
                    index_positions,
                    indexed_arrays,
                    non_indexed_arrays,
                    derived_from_indices):
        """Looks at the indices of a getitem or setitem to see if there
           is a reason that they would prevent fusion.
           Returns True if fusion should be prohibited, False otherwise.
        """
        if isinstance(stmt_index, ir.Var):
            # If the array is 2+ dimensions then the index should be a tuple.
            if isinstance(typemap[stmt_index.name], types.BaseTuple):
                # Get how the index tuple is constructed.
                fbs_res = guard(find_build_sequence, func_ir, stmt_index)
                if fbs_res is not None:
                    ind_seq, _ = fbs_res
                    # If any indices are derived from an index is used then
                    # return True to say we can't fuse.
                    if (all([x.name in indices or
                        x.name not in derived_from_indices for x in ind_seq])):
                        # Get position in index tuple where parfor indices used.
                        new_index_positions = [x.name in indices for x in ind_seq]
                        # Make sure that we aren't accessing a given array with
                        # different indices in a different order.
                        return add_check_position(new_index_positions,
                                                  array_accessed,
                                                  index_positions,
                                                  indexed_arrays,
                                                  non_indexed_arrays)
                    else:
                        # index derived from a parfor index used so no fusion
                        return True
                else:
                    # Don't know how the index tuple is built so
                    # have to assume fusion can't happen.
                    return True
            else:
                # Should be for 1D arrays.
                if stmt_index.name in indices:
                    # Array indexed by a parfor index variable.
                    # Make sure this 1D access is consistent with prior ones.
                    return add_check_position((True,),
                                              array_accessed,
                                              index_positions,
                                              indexed_arrays,
                                              non_indexed_arrays)
                elif stmt_index.name in derived_from_indices:
                    # If we ever index an array with something calculated
                    # from an index then no fusion.
                    return True
                else:
                    # Some kind of index that isn't a parfor index or
                    # one derived from one, e.g., a constant.  Make sure
                    # this is consistent with prior accessed of this array.
                    return add_check_position((False,),
                                              array_accessed,
                                              index_positions,
                                              indexed_arrays,
                                              non_indexed_arrays)
        else:
            # We don't know how to handle non-Var indices so no fusion.
            return True

        # All branches above should cover all the cases and each should
        # return so we should never get here.
        raise errors.InternalError("Some code path in the parfor fusion "
                                   "cross-iteration dependency checker "
                                   "check_index didn't return a result.")
Looks at the indices of a getitem or setitem to see if there
           is a reason that they would prevent fusion.
           Returns True if fusion should be prohibited, False otherwise.
        
numba/parfors/parfor.py