[PATCH] D147568: [InstCombine] Preserve nsw/nuw flags in canonicalization

Eric Gullufsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 13:26:28 PDT 2023


emgullufsen created this revision.
emgullufsen added reviewers: spatel, bcl5980.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
emgullufsen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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

I don't have links to every combination of flag + logic op, but I have used alive-tv to verify all combos

Alive2 verification for add, or -> or, add where add has nuw and nsw flags <https://alive2.llvm.org/ce/z/JCZajo>
Alive2 verification for add, xor -> xor, add where add has just nsw <https://alive2.llvm.org/ce/z/eixEAB>
Alive2 verification for add, and -> and, add where add has just nuw <https://alive2.llvm.org/ce/z/37zf54>


https://reviews.llvm.org/D147568

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/and-xor-or.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147568.510911.patch
Type: text/x-patch
Size: 5970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230404/d61387dd/attachment.bin>


More information about the llvm-commits mailing list