[PATCH] Teach IndVarSimplify to add nuw and nsw to operations that provably don't overflow.

hfinkel at anl.gov hfinkel at anl.gov
Tue Dec 23 15:17:49 PST 2014


We normally don't add otherwise-provable nsw/nuw unless is specifically enables some other optimization where these facts are difficult to prove. As you might know, there are some optimizations that are valid on overflowing operators that are not valid on non-overflowing ones, so adding nsw/nuw is, generally speaking, not a pure win.

That having been said, I don't see this being a particular issue for induction-variable increment operations on canonical loops, and so this likely makes sense as part of the loop canonical form (I can imagine targets taking advantage of these flags during instruction selection, for example). I'd like you to further comment on your motivation for doing this, but LGTM.


http://reviews.llvm.org/D6748

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list