[PATCH] D29729: [InstCombine] don't lose nsw/nuw from add by converting to xor

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 10:48:27 PST 2017


efriedma added a comment.

Fundamentally, many optimizations which simplify code involve dropping information which could be derived from the unoptimized code; we don't attempt to keep around all possible information which could be used by the optimizer.  For example, combining nsw "a + 1 - 1" to "a" drops the information that "a" is not INT_MAX, and that's fine.

You can't actually use llvm.assume to record nsw information because nsw doesn't act like other metadata: overflow produces poison rather than undefined behavior.


https://reviews.llvm.org/D29729





More information about the llvm-commits mailing list