@@ -4319,6 +4319,13 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
masked_p = (ifn == IFN_MASK_LOAD || ifn == IFN_MASK_STORE);
}
+ /* ??? For epilogues we adjust DR_REF to make the following stmt-based
+ analysis work, but this adjustment doesn't work for epilogues of
+ epilogues during transform, so disable gather/scatter in that case. */
+ if (LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+ && LOOP_VINFO_EPILOGUE_P (LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo)))
+ return false;
+
/* True if we should aim to use internal functions rather than
built-in functions. */
bool use_ifn_p = (DR_IS_READ (dr)
@@ -12294,6 +12294,9 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance)
if (STMT_VINFO_MEMORY_ACCESS_TYPE (vstmt_vinfo) == VMAT_GATHER_SCATTER
|| STMT_VINFO_GATHER_SCATTER_P (vstmt_vinfo))
{
+ /* ??? As we copy epilogues from the main loop incremental
+ replacement from an already replaced DR_REF from vectorizing
+ the first epilogue will fail. */
DR_REF (dr)
= simplify_replace_tree (DR_REF (dr), NULL_TREE, NULL_TREE,
&find_in_mapping, &mapping);