[PATCH] D62463: [ValueTracking][ConstantRange] Distinguish low/high always overflow

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 11:58:52 PDT 2019

lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Looks reasonable.

Comment at: llvm/include/llvm/Analysis/ValueTracking.h:416
+  enum class OverflowResult {
+    AlwaysOverflowsLow, AlwaysOverflowsHigh, MayOverflow, NeverOverflows
+  };
nikic wrote:
> lebedev.ri wrote:
> > These now need a comment for each.
> > While with the enum on the LHS of the diff it is obvious,
> > here i'm not sure what low/high means.
> > The direction of the overflow?
> Yeah, this is the direction of overflow. For AlwaysOverflowLow the real result would be lower than signed/unsigned min, for AlwaysOverflowHigh it would be higher than signed/unsigned max.
Thanks. Hmm, still a bit confusing, maybe adding a simple examples could help. Or not.

Comment at: llvm/lib/IR/ConstantRange.cpp:1211
   // a u+ b overflows iff a u> ~b.
   if (Min.ugt(~OtherMin))
overflows low



More information about the llvm-commits mailing list