[all-commits] [llvm/llvm-project] 59c5d5: [X86] Enable preferZeroCompareBranch() (#219919)

Hans Wennborg via All-commits all-commits at lists.llvm.org
Wed Sep 9 01:35:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59c5d5efb7343424d243e4a3972f7b24a07b115d
      https://github.com/llvm/llvm-project/commit/59c5d5efb7343424d243e4a3972f7b24a07b115d
  Author: Hans Wennborg <hans at hanshq.net>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    A llvm/test/CodeGen/X86/branch-on-zero.ll

  Log Message:
  -----------
  [X86] Enable preferZeroCompareBranch() (#219919)

This makes CodeGenPrepare reorganize code such as:

```
%c = icmp eq i32 %x, 10
br %c, then, else
%a = add i32 %x, -10
```

into

```
%a = add i32 %x, -10
%cmp = icmp eq %a, 0
%br %cmp, then, else
```

so that the zero-compare and branch gets lowered to a JCC based on the
flags from the arithmetic instruction.

This was already enabled for ARM, SystemZ and RISC-V, but seems a good
fit for X86 too, as mentioned in Issue #58636.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list