[PATCH] [SLSR] handle candidate form &B[i * S]

Sanjoy Das sanjoy at playingwithpointers.com
Tue Mar 10 15:09:26 PDT 2015


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:325
@@ +324,3 @@
+    Instruction *I) {
+  // I = B + sext(Idx *s S) *s ElementSize
+  //   = B + (sext(Idx) * ElementSize) * sext(S)
----------------
Nit: `*s` is confusing -- there is no difference between signed vs. unsigned integer multiplication.  If you mean `nsw` then `*nsw` is clearer.

================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:378
@@ +377,3 @@
+      // sext'ed multiplication.
+      if (match(Idx, m_Mul(m_Value(LHS), m_ConstantInt(RHS)))) {
+        // SLSR is currently unsafe if i * S may overflow.
----------------
You can use `m_NSWMul` here directly.

http://reviews.llvm.org/D7459

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






More information about the llvm-commits mailing list