[PATCH] [Unfinished] Use modulo semantic to generate non-wrap assumptions

Johannes Doerfert doerfert at cs.uni-saarland.de
Tue Apr 28 03:14:37 PDT 2015


some comments


================
Comment at: lib/Analysis/ScopInfo.cpp:85
@@ +84,3 @@
+  /// @param Expr      The expression that is translated.
+  /// @param UseModulo Flag to indicate that modulo semantic should be used.
+  static __isl_give isl_pw_aff *getPwAff(ScopStmt *Stmt, const SCEV *Expr,
----------------
grosser wrote:
> semantics
done.

================
Comment at: lib/Analysis/ScopInfo.cpp:94
@@ -91,2 +93,3 @@
 
-  SCEVAffinator(const ScopStmt *Stmt);
+  /// @brief Flag to indicate that modulo semantic should be used.
+  const bool UseModulo;
----------------
grosser wrote:
> semantics
done.

================
Comment at: lib/Analysis/ScopInfo.cpp:145
@@ +144,3 @@
+  // If the SCEV flags do contain NSW (no signed wrap) then PWA already
+  // represents Expr in modulo semantic (it cannot overflow), thus we are done.
+  // Otherwise, we will compute:
----------------
grosser wrote:
> "represents Expr in modulo semantic"
> 
> What do you mean here? As you state right after, overflow is known to never happen. Hence, I don't see how this expression
> defines overflow semantics. Maybe just say that we know overflow is undefined and are free to choose the definition to
> use in our model. As wrapping is computationally more difficult to model we avoid it when allowed.
It depends on the interpretation of the nsw flag. I assumed it is a certificate/proof that no overflow can happen, thus the expression is equal to the expression with modulo semantics. You say it is only well defined if this is the case, thus it is not always equal but we can ignore the cases it is not. 

================
Comment at: test/ScopInfo/wraping_signed_expr_2.ll:9
@@ +8,3 @@
+; The wrap function has no inbounds GEP but the nowrap function has. Therefore,
+; we will add the assumption that i+1 won't overflow only to the former.
+;
----------------
grosser wrote:
> i + 30
done.

http://reviews.llvm.org/D9099

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






More information about the llvm-commits mailing list