https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116133
Bug ID: 116133 Summary: Missing mult_overflow detection for aarch64 Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: aarch64-linux-gnu Using the testcase from PR 95852: ``` bool f(unsigned x, unsigned y, unsigned* res) { *res = x * y; return x && ((*res / x) != y); } ``` This should be optimized to just: ``` _14 = (int) x_7(D); _15 = (int) y_8(D); _16 = .MUL_OVERFLOW (_14, _15); _17 = REALPART_EXPR <_16>; _1 = (unsigned int) _17; _18 = IMAGPART_EXPR <_16>; *res_10(D) = _1; _12 = _18 != 0; _13 = (int) _12; ``` Like it is on x86_64 But it looks like widening multiply is not considered if MUL_OVERFLOW will be better than the original IR.