[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)
Akshay Deodhar via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 15:02:07 PDT 2024
akshayrdeodhar wrote:
There's a specific case that this PR does not cover. It is legal to preserve all NSWs in `((a + b) + c) => ((a + c) + b)` if `a >= 0, b >= 0`, without a constraint on c. (https://alive2.llvm.org/ce/z/G4XW6Q)
One way to handle this would be using a `m_Add(m_NSWAdd(A, B), C)`, and checking for positivity of A and B. Is this a generally applicable case, and is having such a "special case" rule a good idea?
https://github.com/llvm/llvm-project/pull/93105
More information about the llvm-commits
mailing list