[all-commits] [llvm/llvm-project] db32d1: [Reassociate] Keep flags for more unchanged operat...

David Green via All-commits all-commits at lists.llvm.org
Mon Jul 3 02:05:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db32d11a386ed20bb44448e671a641cc895d65f8
      https://github.com/llvm/llvm-project/commit/db32d11a386ed20bb44448e671a641cc895d65f8
  Author: David Green <david.green at arm.com>
  Date:   2023-07-03 (Mon, 03 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/Reassociate.cpp
    M llvm/test/Transforms/Reassociate/cse-pairs.ll
    M llvm/test/Transforms/Reassociate/local-cse.ll

  Log Message:
  -----------
  [Reassociate] Keep flags for more unchanged operations

Reassociation destroys nsw/nuw flags from BinOps that are changed. But if the
expression at the end of a tree that was altered, but didn't change itself,
the flags do not need to be removed. For example, if %a, %b and %c are
reassociated in
  %x = add nsw i32 %a, %c
  %y = add nsw i32 %x, %b
  %z = add nsw i32 %y, %d
The value of %y and so add %y %d remains the same, and %z needn't drop the nsw
flags.
https://alive2.llvm.org/ce/z/_juAiV

Differential Revision: https://reviews.llvm.org/D154289




More information about the All-commits mailing list