https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114769
Bug ID: 114769 Summary: Suspicious code in vect_recog_sad_pattern() Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: fxue at os dot amperecomputing.com Target Milestone: --- This function may contain buggy code, which was introduced due to recent support to the new ABD pattern. It calls "vect_recog_absolute_difference" to check ABS/ABSU statement, if succeed, it expects that "vect_unpromoted_value unprom[2]" is properly set for the two operands. Though, at the final code snippet, this is missed, so "unprom" could have unwanted values. /* Failed to find a widen operation so we check for a regular MINUS_EXPR. */ gassign *diff = dyn_cast <gassign *> (STMT_VINFO_STMT (diff_stmt_vinfo)); if (diff_stmt && diff && gimple_assign_rhs_code (diff) == MINUS_EXPR && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd))) { *diff_stmt = diff; *half_type = NULL_TREE; // unprom is not set accordingly return true; } This execution path would be triggered for an architecture that merely support dot-product instruction, but w/o "IFN_ABD" and "IFN_VEC_WIDEN_ABD" instructions.