[llvm] r202195 - R600: Don't unconditionally unroll loops with private memory accesses

Tom Stellard thomas.stellard at amd.com
Tue Feb 25 13:36:22 PST 2014


Author: tstellar
Date: Tue Feb 25 15:36:21 2014
New Revision: 202195

URL: http://llvm.org/viewvc/llvm-project?rev=202195&view=rev
Log:
R600: Don't unconditionally unroll loops with private memory accesses

This causes the size of the scrypt kernel to explode and eats all the
memory on some systems.

Modified:
    llvm/trunk/lib/Target/R600/AMDGPUTargetTransformInfo.cpp

Modified: llvm/trunk/lib/Target/R600/AMDGPUTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUTargetTransformInfo.cpp?rev=202195&r1=202194&r2=202195&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUTargetTransformInfo.cpp Tue Feb 25 15:36:21 2014
@@ -110,9 +110,13 @@ void AMDGPUTTI::getUnrollingPreferences(
         // instructions that make it through to the code generator.  allocas
         // require us to use indirect addressing, which is slow and prone to
         // compiler bugs.  If this loop does an address calculation on an
-        // alloca ptr, then we want to unconditionally unroll the loop.  In most
-        // cases, this will make it possible for SROA to eliminate these allocas.
-        UP.Threshold = UINT_MAX;
+        // alloca ptr, then we want to use a higher than normal loop unroll
+	// threshold.  This will give SROA a better chance to eliminate these
+	// allocas.
+	//
+	// Don't use the maximum allowed value here as it will make some
+	// programs way too big.
+        UP.Threshold = 500;
       }
     }
   }





More information about the llvm-commits mailing list