[llvm] [CollapseIdenticalNodesPass + New Opt pipeline for better codegen] (PR #184943)

Kirill Barinov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 19:46:57 PST 2026


Barkir wrote:


EXAMPLE OF TEST WITH NON-OPTIMAL IR CODEGEN.

int test1(int a, int b, int c) {
    if (a == 46346 && b == 5745 && c == 5)
        return 46346 * 5745;

    return a * b;
}
////////////////////////////////////////////////////////////
IR DIFF
<   %cmp = icmp eq i32 %a, 46346
<   %cmp1 = icmp eq i32 %b, 5745
<   %or.cond = and i1 %cmp, %cmp1
<   %cmp3 = icmp eq i32 %c, 5
<   %or.cond1 = and i1 %or.cond, %cmp3
15,16c10
<   %retval.0 = select i1 %or.cond1, i32 266257770, i32 %mul
<   ret i32 %retval.0
---
>   ret i32 %mul



https://github.com/llvm/llvm-project/pull/184943


More information about the llvm-commits mailing list