[PATCH] [LSR] Canonicalize reg1 + ... + regN into reg1 + ... + 1*regN

Andrew Trick atrick at apple.com
Mon May 19 17:10:35 PDT 2014


Great work cleaning up this aspect of LSR!

================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:839-841
@@ -778,5 +838,5 @@
 }
-// Check if it is legal to fold 2 base registers.
-static bool isLegal2RegAMUse(const TargetTransformInfo &TTI, const LSRUse &LU,
-                             const Formula &F);
+// Check if the addressing mode is completely folded in the given use.
+static bool isAMCompletelyFolded(const TargetTransformInfo &TTI,
+                                 const LSRUse &LU, const Formula &F);
 // Get the cost of the scaling factor used in F for LU.
----------------
I don't understand the name isAMCompletelyFolded(TTI, LU, F) in this case. It seems to be used to mean "can fold exactly 2 registers".

================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1454-1456
@@ +1453,5 @@
+                                 const Formula &F) {
+  // For the purpose of isAMCompletelyFolded either having a canonical formula
+  // or a scale
+  // not equal to zero is correct.
+  // Problems may arise from non canonical formulae having a scale == 0.
----------------
Word wrap.

http://reviews.llvm.org/D3830






More information about the llvm-commits mailing list