[all-commits] [llvm/llvm-project] 8e516d: [InstCombine] Infer nuw flags for `C-(X+C2)` -> `(...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed Nov 15 10:36:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8e516d48fedc1d0b537fe0e134259ac077e5df16
      https://github.com/llvm/llvm-project/commit/8e516d48fedc1d0b537fe0e134259ac077e5df16
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/addsub-constant-folding.ll

  Log Message:
  -----------
  [InstCombine] Infer nuw flags for `C-(X+C2)` -> `(C-C2)-X` (#72373)

This patch improves https://reviews.llvm.org/D152068 by inferring NUW
flags for sub insts.
It is worth noting that we don't need to check overflow for `C-C2`.
Alive2: https://alive2.llvm.org/ce/z/uutGpS

This missed optimization is discovered with the help of
https://github.com/AliveToolkit/alive2/pull/962.




More information about the All-commits mailing list