[all-commits] [llvm/llvm-project] 59388f: [InstCombine] Preserve NSW/NUW flags when folding ...

Alex MacLean via All-commits all-commits at lists.llvm.org
Fri Jun 13 11:17:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59388fb0b92d7efd5737efd6c7b6d5c82f1bc6a8
      https://github.com/llvm/llvm-project/commit/59388fb0b92d7efd5737efd6c7b6d5c82f1bc6a8
  Author: Alex MacLean <amaclean at nvidia.com>
  Date:   2025-06-13 (Fri, 13 Jun 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/canonicalize-const-to-bop.ll

  Log Message:
  -----------
  [InstCombine] Preserve NSW/NUW flags when folding const BOp with min/max (#143471)

When folding `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp
C1`, if NUW/NSW flags are present on `X BOp C1` and could be safely
applied to `C2 BOp C1`, then they may be added on the BOp after the fold
is complete. https://alive2.llvm.org/ce/z/n_3aNJ

Preserving these flags can allow subsequent transforms to re-order the
min/max and BOp, which in the case of NVPTX would allow for some
potential future transformations which would improve
instruction-selection.



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