From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 349C33858D1E; Wed, 17 May 2023 13:59:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 349C33858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684331997; bh=j6QbP0WaGoFau+bU2AE2HVYXhteDKh0E6A7Dsq3//to=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RjNa3S3i5/Wd2j5K4QJwkhFlmDsTrFGkMXenkTYDRssK+0SLfQOuOU12sIcBobqZZ 2Ml9FckmjkpDipaQ+0MFxQdtOiicURFlEeAvYLdYL38fZdwROc4CG0FgfqkLeNuygd DKniFwQQPG+uIaa2ExjtJQFcpMpaCUmpatrinRs4= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109811] libjxl 0.7 is a lot slower in GCC 13.1 vs Clang 16 Date: Wed, 17 May 2023 13:59:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109811 JuzheZhong changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |juzhe.zhong at rivai dot ai --- Comment #7 from JuzheZhong --- (In reply to Jan Hubicka from comment #6) > hottest loop in clang's profile is: > for (size_t y =3D 0; y < opsin.ysize(); y++) { > for (size_t x =3D 0; x < opsin.xsize(); x++) { > if (is_background_row[y * is_background_stride + x]) continue; > cc.clear(); > stack.clear(); > stack.emplace_back(x, y); > size_t min_x =3D x; > size_t max_x =3D x; > size_t min_y =3D y; > size_t max_y =3D y; > std::pair reference; > bool found_border =3D false; > bool all_similar =3D true; > while (!stack.empty()) { > std::pair cur =3D stack.back(); > stack.pop_back(); > if (visited_row[cur.second * visited_stride + cur.first]) continu= e; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > closed by this continue. > visited_row[cur.second * visited_stride + cur.first] =3D 1; > if (cur.first < min_x) min_x =3D cur.first; > if (cur.first > max_x) max_x =3D cur.first; > if (cur.second < min_y) min_y =3D cur.second; > if (cur.second > max_y) max_y =3D cur.second; > if (paint_ccs) { > cc.push_back(cur); > } > for (int dx =3D -kSearchRadius; dx <=3D kSearchRadius; dx++) { > for (int dy =3D -kSearchRadius; dy <=3D kSearchRadius; dy++) { > if (dx =3D=3D 0 && dy =3D=3D 0) continue; > int next_first =3D static_cast(cur.first) + dx; > int next_second =3D static_cast(cur.second) + dy; > if (next_first < 0 || next_second < 0 || > static_cast(next_first) >=3D opsin.xsize() || > static_cast(next_second) >=3D opsin.ysize()) { > continue; > } > std::pair next{next_first, next_second}; > if (!is_background_row[next.second * is_background_stride + > next.first]) { > stack.push_back(next); > } else { > if (!found_border) { > reference =3D next; > found_border =3D true; > } else { > if (!is_similar_b(next, reference)) all_similar =3D false; > } > } > } > } > } > if (!found_border || !all_similar || max_x - min_x >=3D kMaxPatchSi= ze || > max_y - min_y >=3D kMaxPatchSize) { > continue; > } > size_t bpos =3D background_stride * reference.second + reference.fi= rst; > float ref[3] =3D {background_rows[0][bpos], background_rows[1][bpos= ], > background_rows[2][bpos]}; > bool has_similar =3D false; > for (size_t iy =3D std::max( > static_cast(min_y) - kHasSimilarRadius, 0); > iy < std::min(max_y + kHasSimilarRadius + 1, opsin.ysize()); > iy++) { > for (size_t ix =3D std::max( > static_cast(min_x) - kHasSimilarRadius, 0); > ix < std::min(max_x + kHasSimilarRadius + 1, opsin.xsize()); > ix++) { > size_t opos =3D opsin_stride * iy + ix; > float px[3] =3D {opsin_rows[0][opos], opsin_rows[1][opos], > opsin_rows[2][opos]}; > if (pci.is_similar_v(ref, px, kHasSimilarThreshold)) { > has_similar =3D true; > } > } > } > if (!has_similar) continue; > info.emplace_back(); > info.back().second.emplace_back(min_x, min_y); > QuantizedPatch& patch =3D info.back().first; > patch.xsize =3D max_x - min_x + 1; > patch.ysize =3D max_y - min_y + 1; > int max_value =3D 0; > for (size_t c : {1, 0, 2}) { > for (size_t iy =3D min_y; iy <=3D max_y; iy++) { > for (size_t ix =3D min_x; ix <=3D max_x; ix++) { > size_t offset =3D (iy - min_y) * patch.xsize + ix - min_x; > patch.fpixels[c][offset] =3D > opsin_rows[c][iy * opsin_stride + ix] - ref[c]; > int val =3D pci.Quantize(patch.fpixels[c][offset], c); > patch.pixels[c][offset] =3D val; > if (std::abs(val) > max_value) max_value =3D std::abs(val); > } > } > } > if (max_value < kMinPeak) { > info.pop_back(); > continue; > } > if (paint_ccs) { > float cc_color =3D rng.UniformF(0.5, 1.0); > for (std::pair p : cc) { > ccs.Row(p.second)[p.first] =3D cc_color; > } > } > } > } >=20 > I guess such a large loop nest with hottest loop not being the innermost = is > bad for register pressure.=20 > Clangs code is : > 0.02 =E2=94=821196:=E2=94=8C=E2=94=80=E2=86=92cmp %r10,-0xb8(%= rbp)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82jxl::FindBestPatchDictionary(jxl::Image3 const&, > jxl::PassesEncoderState*, JxlCmsInterface co=E2=96=92 > =E2=94=82 =E2=94=82while (!stack.empty()) {=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=97=86 > 1.39 =E2=94=82 =E2=94=82=E2=86=93 je 1690=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=8211a3:=E2=94=82 mov -0x8(%r10),%rbx=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 > =E2=96=92 > 9.80 =E2=94=82 =E2=94=82 mov -0x230(%rbp),%r14=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82__gnu_cxx::__normal_iterator int>*, std::vector =E2=94=82 =E2=94=82{ return __normal_iterator(_M_current - __n= ); }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 0.86 =E2=94=82 =E2=94=82 add $0xfffffffffffffff8,%r10=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82jxl::FindBestPatchDictionary(jxl::Image3 const&, > jxl::PassesEncoderState*, JxlCmsInterface co=E2=96=92 > 0.36 =E2=94=82 =E2=94=82 mov %rbx,%r13=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 0.01 =E2=94=82 =E2=94=82 shr $0x20,%r13=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 2.69 =E2=94=82 =E2=94=82 mov %ebx,%eax=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 0.00 =E2=94=82 =E2=94=82 mov %r13,%rcx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 1.12 =E2=94=82 =E2=94=82 imul -0x180(%rbp),%rcx=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > 0.78 =E2=94=82 =E2=94=82 add %rax,%rcx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 2.73 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80cmpb $0x0,(%r14,%= rcx,1)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 > =E2=96=92 > 19.91 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80jne 1196=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 >=20 > While GCC is longer: > Percent=E2=94=82 Percent=E2=94=82 while (!stack.empty()) {=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=821241:=E2=94=8C=E2=94=80=E2=86=92cmp %rax,-0x370(%= rbp)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.70 =E2=94=82 =E2=94=82=E2=86=93 je 1481=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 0.02 =E2=94=82124e:=E2=94=82 mov -0x8(%rax),%rdx=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::vector, > std::allocator > >::pop_back=E2=96= =92 > =E2=94=82 =E2=94=82--this->_M_impl._M_finish;=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 > =E2=96=92 > 0.63 =E2=94=82 =E2=94=82 sub $0x8,%rax=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.74 =E2=94=82 =E2=94=82 mov %rax,-0x368(%rbp)=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82FindTextLikePatches():=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.01 =E2=94=82 =E2=94=82 mov %edx,%esi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=97=86 > 0.35 =E2=94=82 =E2=94=82 mov %rdx,%rdi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.82 =E2=94=82 =E2=94=82 mov %rdx,-0x490(%rbp)=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.00 =E2=94=82 =E2=94=82 mov -0x5f8(%rbp),%rdx=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 1.32 =E2=94=82 =E2=94=82 shr $0x20,%rdi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 0.11 =E2=94=82 =E2=94=82 mov %rsi,%r15=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.09 =E2=94=82 =E2=94=82 mov %edi,%ecx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.72 =E2=94=82 =E2=94=82 mov -0x5f0(%rbp),%rdi=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 0.03 =E2=94=82 =E2=94=82 mov %rcx,%r12=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.39 =E2=94=82 =E2=94=82 imul %rcx,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.00 =E2=94=82 =E2=94=82 add %rsi,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.35 =E2=94=82 =E2=94=82 add %rdi,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.37 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80cmpb $0x0,(%rdx)= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 9.56 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80jne 1241=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 while (!stack.empty()) {=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=821241:=E2=94=8C=E2=94=80=E2=86=92cmp %rax,-0x370(%= rbp)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.70 =E2=94=82 =E2=94=82=E2=86=93 je 1481=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 0.02 =E2=94=82124e:=E2=94=82 mov -0x8(%rax),%rdx=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::vector, > std::allocator > >::pop_back=E2=96= =92 > =E2=94=82 =E2=94=82--this->_M_impl._M_finish;=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 > =E2=96=92 > 0.63 =E2=94=82 =E2=94=82 sub $0x8,%rax=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.74 =E2=94=82 =E2=94=82 mov %rax,-0x368(%rbp)=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82FindTextLikePatches():=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.01 =E2=94=82 =E2=94=82 mov %edx,%esi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=97=86 > 0.35 =E2=94=82 =E2=94=82 mov %rdx,%rdi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.82 =E2=94=82 =E2=94=82 mov %rdx,-0x490(%rbp)=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.00 =E2=94=82 =E2=94=82 mov -0x5f8(%rbp),%rdx=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 1.32 =E2=94=82 =E2=94=82 shr $0x20,%rdi=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 > =E2=96=92 > 0.11 =E2=94=82 =E2=94=82 mov %rsi,%r15=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 0.09 =E2=94=82 =E2=94=82 mov %edi,%ecx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.72 =E2=94=82 =E2=94=82 mov -0x5f0(%rbp),%rdi=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > =E2=96=92 > =E2=94=82 =E2=94=82std::pair cur =3D stack= .back();=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 0.03 =E2=94=82 =E2=94=82 mov %rcx,%r12=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > =E2=94=82 =E2=94=82if (visited_row[cur.second * visited_stride= + cur.first]) > continue; =E2=96=92 > 0.39 =E2=94=82 =E2=94=82 imul %rcx,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.00 =E2=94=82 =E2=94=82 add %rsi,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.35 =E2=94=82 =E2=94=82 add %rdi,%rdx=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > =E2=96=92 > 1.37 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80cmpb $0x0,(%rdx)= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 > 9.56 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80jne 1241=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > =E2=96=92 >=20 >=20 > Moreover we have heuristics saying that continue usually closes loops with > low trip count. > -fno-ivopts improves performance with --num_threads=3D0 however makes num= ber > of instructions worse. Curiously enought with --num_threads=3D1 and more > ivopts is benefical. Hi, thanks for the analysis. It seems that Clang has better performance than GCC in case of no vectorize= r? What about with vectorizer ? Well, we have a lot testing benchmark between our downstream RISCV Clang vs GCC. >From my observation, Clang do much better than GCC in case of scalar code. For example, we found in mlperf, Clang 40% better than GCC when specifying no-vectorizer. However, when enabling vectorization, gcc does better than c= lang overall from my observation. Thanks=