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

hfinkel at anl.gov hfinkel at anl.gov
Mon Mar 9 16:48:13 PDT 2015


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:214
@@ +213,3 @@
+
+  if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GEP->getPointerOperand())) {
+    BaseGV = GV;
----------------
Don't need the { } here.

================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:366
@@ +365,3 @@
+      ConstantInt *RHS = nullptr;
+      // TODO: handle shl. e.g., we could treat (S << 2) as (S * 4).
+      if (match(Idx, m_Mul(m_Value(LHS), m_ConstantInt(RHS)))) {
----------------
Can't you use SCEV to do that here? If you do, then you get the shift case for free. If the problem here is the loss of the information on the NSW, please comment on that.


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:444
@@ +443,3 @@
+      } else {
+        // C = inttoptr(ptrtoint(Basis) + Bump)
+        Reduced = Builder.CreatePtrToInt(Basis.Ins, IntPtrTy);
----------------
No, please don't do that. Cast the pointer to an i8* (in the appropriate address space), and use a GEP.

http://reviews.llvm.org/D7459

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






More information about the llvm-commits mailing list