diff --git a/loopy/diagnostic.py b/loopy/diagnostic.py
index 93cbd125de96e0481a3f466c0a7e96dd04c89cd7..2ea1bd40e540b24d5a08e4136ab603d6c5a422a1 100644
--- a/loopy/diagnostic.py
+++ b/loopy/diagnostic.py
@@ -78,6 +78,10 @@ class AutomaticTestFailure(LoopyError):
     pass
 
 
+class StaticValueFindingError(LoopyError):
+    pass
+
+
 class DependencyTypeInferenceFailure(TypeInferenceFailure):
     def __init__(self, message, symbol):
         TypeInferenceFailure.__init__(self, message)
diff --git a/loopy/isl_helpers.py b/loopy/isl_helpers.py
index a7b6c4348fb0e4d29b9a164ed63f0a8aa7085aec..33e91b4c7ebda4b68740e7d876de37ac611e9dfd 100644
--- a/loopy/isl_helpers.py
+++ b/loopy/isl_helpers.py
@@ -196,7 +196,7 @@ def static_extremum_of_pw_aff(pw_aff, constants_only, set_method, what, context)
 
     # }}}
 
-    raise ValueError("a static %s was not found for PwAff '%s'"
+    raise StaticValueFindingError("a static %s was not found for PwAff '%s'"
             % (what, pw_aff))
 
 
diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py
index 27c0a2218286b57f4756d2f92f106a82c0694135..dd93ab2f368f0f4ac560f3ac73e336a8448af487 100644
--- a/loopy/kernel/tools.py
+++ b/loopy/kernel/tools.py
@@ -292,21 +292,49 @@ class SetOperationCacheManager:
         lower_bound_pw_aff = self.dim_min(set, idx)
         upper_bound_pw_aff = self.dim_max(set, idx)
 
-        from loopy.isl_helpers import static_max_of_pw_aff, static_value_of_pw_aff
+        from loopy.diagnostic import StaticValueFindingError
+        from loopy.isl_helpers import (
+                static_max_of_pw_aff,
+                static_min_of_pw_aff,
+                static_value_of_pw_aff)
         from loopy.symbolic import pw_aff_to_expr
 
+        # {{{ first: try to find static lower bound value
+
+        try:
+            base_index_aff = static_value_of_pw_aff(
+                    lower_bound_pw_aff, constants_only=False,
+                    context=context)
+        except StaticValueFindingError:
+            base_index_aff = None
+
+        if base_index_aff is not None:
+            base_index = pw_aff_to_expr(base_index_aff)
+
+            size = pw_aff_to_expr(static_max_of_pw_aff(
+                    upper_bound_pw_aff - base_index_aff + 1, constants_only=False,
+                    context=context))
+
+            return base_index, size
+
+        # }}}
+
+        # {{{ if that didn't work, try finding a lower bound
+
+        base_index_aff = static_min_of_pw_aff(
+                lower_bound_pw_aff, constants_only=False,
+                context=context)
+
+        base_index = pw_aff_to_expr(base_index_aff)
+
         size = pw_aff_to_expr(static_max_of_pw_aff(
-                upper_bound_pw_aff - lower_bound_pw_aff + 1, constants_only=False,
+                upper_bound_pw_aff - base_index_aff + 1, constants_only=False,
                 context=context))
-        try:
-            base_index = pw_aff_to_expr(
-                    static_value_of_pw_aff(lower_bound_pw_aff, constants_only=False,
-                        context=context))
-        except Exception as e:
-            raise type(e)("while finding lower bound of '%s': %s" % (iname, str(e)))
 
         return base_index, size
 
+        # }}}
+
 # }}}