[all-commits] [llvm/llvm-project] 9c7e02: [InstCombine] Fold umax(nuw_mul(x, C0), x + 1) int...

Ruhung via All-commits all-commits at lists.llvm.org
Mon Jan 20 07:32:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c7e02d579db7ba81a414cd2212ce2b48b927941
      https://github.com/llvm/llvm-project/commit/9c7e02d579db7ba81a414cd2212ce2b48b927941
  Author: Ruhung <143302514+Ruhung at users.noreply.github.com>
  Date:   2025-01-20 (Mon, 20 Jan 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    A llvm/test/Transforms/InstCombine/add-shl-mul-umax.ll

  Log Message:
  -----------
  [InstCombine] Fold umax(nuw_mul(x, C0), x + 1) into (x == 0 ? 1 : nuw_mul(x, C0)) (#123468)

This PR introduces the following transformations:

- If C0 is not 0:  
umax(nuw_shl(x, C0), x + 1) -> x == 0 ? 1 : nuw_shl(x, C0)  
- If C0 is not 0 or 1:  
umax(nuw_mul(x, C0), x + 1) -> x == 0 ? 1 : nuw_mul(x, C0)  

Fixes #122388.
Alive2 proof: https://alive2.llvm.org/ce/z/rkp_8U



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