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

Tobias Grosser tobias at grosser.es
Mon Apr 27 23:43:54 PDT 2015


Thanks for the update.

The patch looks good indeed.

I unfortunately I don't have a solution handy for the modulo issue. In the worst case we just put a compute-out here, but first we should understand why this complement is so expensive for isl (complements and subtracts sometimes are) and possibly run it through Sven to see if there is something we can optimize? We could also extract this as a 5 line isl test case and give it to Sven.

Best,
Tobias


================
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,
----------------
semantics

================
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;
----------------
semantics

================
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:
----------------
"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.

================
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.
+;
----------------
i + 30

http://reviews.llvm.org/D9099

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






More information about the llvm-commits mailing list