[PATCH] D124119: [InstCombine] Combine instructions of type or/and where AND masks can be combined.
Alexander Kornienko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 03:21:51 PDT 2022
alexfh added a comment.
In D124119#3549716 <https://reviews.llvm.org/D124119#3549716>, @alexfh wrote:
> I was wrong with the initial analysis. The patch doesn't just make the performance worse. It makes clang loop indefinitely on a certain input.
>
> $ cat q.cc
> int e;
> int u;
> int ag;
> void f() {
> int ak = e;
> int al((unsigned char)(ak >> 23) & 925);
> if (ak)
> al = (ak >> 23 & u) | ((unsigned char)(ak >> 23) & 925) | (u >> 23 & 157);
> ag = al;
> }
>
> $ time ./clang-15-10515 --target=x86_64--linux-gnu -O1 -c q.cc
> ^C
>
> real 0m45.072s
> user 0m0.025s
> sys 0m0.099s
>
> This is definitely a problem that has to be fixed. If you don't have an obvious fix in mind, please revert while investigating.
A bit cleaner test case:
int f(int a, int b) {
int c = ((unsigned char)(a >> 23) & 925);
if (a)
c = (a >> 23 & b) | ((unsigned char)(a >> 23) & 925) | (b >> 23 & 157);
return c;
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124119/new/
https://reviews.llvm.org/D124119
More information about the llvm-commits
mailing list