[llvm] r207462 - Revert r207271 for now. This commit introduced a test case that ran

Chandler Carruth chandlerc at gmail.com
Mon Apr 28 16:07:50 PDT 2014


Author: chandlerc
Date: Mon Apr 28 18:07:49 2014
New Revision: 207462

URL: http://llvm.org/viewvc/llvm-project?rev=207462&view=rev
Log:
Revert r207271 for now. This commit introduced a test case that ran
clang directly from the LLVM test suite! That doesn't work. I've
followed up on the review thread to try and get a viable solution sorted
out, but trying to get the tree clean here.

Removed:
    llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/req-regs.c
Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/lit.local.cfg

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=207462&r1=207461&r2=207462&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Apr 28 18:07:49 2014
@@ -256,7 +256,7 @@ struct Formula {
 
   void InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE);
 
-  size_t getNumRegs() const;
+  unsigned getNumRegs() const;
   Type *getType() const;
 
   void DeleteBaseReg(const SCEV *&S);
@@ -351,7 +351,7 @@ void Formula::InitialMatch(const SCEV *S
 /// getNumRegs - Return the total number of register operands used by this
 /// formula. This does not include register uses implied by non-constant
 /// addrec strides.
-size_t Formula::getNumRegs() const {
+unsigned Formula::getNumRegs() const {
   return !!ScaledReg + BaseRegs.size();
 }
 
@@ -4132,22 +4132,19 @@ void LSRInstance::SolveRecurse(SmallVect
        E = LU.Formulae.end(); I != E; ++I) {
     const Formula &F = *I;
 
-    // Ignore formulae which may not be ideal in terms of register reuse of
-    // ReqRegs.  The formula should use all required registers before
-    // introducing new ones.
-    int NumReqRegsToFind = std::min(F.getNumRegs(), ReqRegs.size());
+    // Ignore formulae which do not use any of the required registers.
+    bool SatisfiedReqReg = true;
     for (SmallSetVector<const SCEV *, 4>::const_iterator J = ReqRegs.begin(),
          JE = ReqRegs.end(); J != JE; ++J) {
       const SCEV *Reg = *J;
-      if ((F.ScaledReg && F.ScaledReg == Reg) ||
-          std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) !=
+      if ((!F.ScaledReg || F.ScaledReg != Reg) &&
+          std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) ==
           F.BaseRegs.end()) {
-        --NumReqRegsToFind;
-        if (NumReqRegsToFind == 0)
-          break;
+        SatisfiedReqReg = false;
+        break;
       }
     }
-    if (NumReqRegsToFind != 0) {
+    if (!SatisfiedReqReg) {
       // If none of the formulae satisfied the required registers, then we could
       // clear ReqRegs and try again. Currently, we simply give up in this case.
       continue;

Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/lit.local.cfg?rev=207462&r1=207461&r2=207462&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/lit.local.cfg (original)
+++ llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/lit.local.cfg Mon Apr 28 18:07:49 2014
@@ -1,4 +1,4 @@
-config.suffixes = ['.ll' '.c']
+config.suffixes = ['.ll']
 
 targets = set(config.root.targets_to_build.split())
 if not 'ARM64' in targets:

Removed: llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/req-regs.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/req-regs.c?rev=207461&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/req-regs.c (original)
+++ llvm/trunk/test/Transforms/LoopStrengthReduce/ARM64/req-regs.c (removed)
@@ -1,36 +0,0 @@
-// RUN: clang %s -O3 -target arm64-apple-ios -o - -S -mllvm -debug-only=loop-reduce 2>&1| FileCheck %s
-// REQUIRES: asserts
-
-// LSR used to fail here due to a bug in the ReqRegs test.  To complicate
-// things, this could only be reproduced with clang because the uses would
-// come out in different order when invoked through llc.
-
-// CHECK: The chosen solution requires
-// CHECK-NOT: No Satisfactory Solution
-
-typedef unsigned long iter_t;
-void use_int(int result);
-
-struct _state {
- int N;
- int M;
- int K;
- double* data;
-};
-void
-do_integer_add(iter_t iterations, void* cookie)
-{
-    struct _state *pState = (struct _state*)cookie;
-    register int i;
-    register int a = pState->N + 57;
-
-    while (iterations-- > 0) {
-        for (i = 1; i < 1001; ++i) {
-          a=a+a+i; a=a+a+i; a=a+a+i; a=a+a+i;
-          a=a+a+i; a=a+a+i; a=a+a+i; a=a+a+i;
-          a=a+a+i; a=a+a+i;
-
-        }
-    }
-    use_int(a);
-}





More information about the llvm-commits mailing list