[InstCombine] Preserve nsw/nuw flags in canonicalization
authorEric Gullufsen <ericgullufsen@gmail.com>
Tue, 4 Apr 2023 19:33:37 +0000 (15:33 -0400)
committerEric Gullufsen <ericgullufsen@gmail.com>
Wed, 5 Apr 2023 14:12:54 +0000 (10:12 -0400)
commitb9bbe2f6037df707372de157e65cc06255673b19
treeac49756a9d94424e620bd908b650cf9d9084af24
parente63902128f8800b231d22aea88a9d3f38eecd172
[InstCombine] Preserve nsw/nuw flags in canonicalization

canonicalizeLogicFirst reorders logic op / math op for suitable
constants, and this commit makes this function pass through
nsw/nuw flags on the Add.

Differential Revision: https://reviews.llvm.org/D147568
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-xor-or.ll