From 6452451c470fa5ad9e21d8fbdee398676550011a Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sat, 21 Mar 2015 19:11:52 -0500
Subject: [PATCH] Allow negation of predicates

---
 loopy/kernel/data.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py
index ba405c15a..871f5359b 100644
--- a/loopy/kernel/data.py
+++ b/loopy/kernel/data.py
@@ -431,8 +431,10 @@ class InstructionBase(Record):
 
     .. attribute:: predicates
 
-        a :class:`frozenset` of variable names whose truth values (as defined
-        by C) determine whether this instruction should be run
+        a :class:`frozenset` of variable names the conjunction (logical and) of
+        whose truth values (as defined by C) determine whether this instruction
+        should be run. Each variable name may, optionally, be preceded by
+        an exclamation point, indicating negation.
 
     .. attribute:: forced_iname_deps_is_final
 
@@ -678,7 +680,10 @@ class ExpressionInstruction(InstructionBase):
         for _, subscript in self.assignees_and_indices():
             result = result | get_dependencies(subscript)
 
-        result = result | self.predicates
+        processed_predicates = frozenset(
+                pred.lstrip("!") for pred in self.predicates)
+
+        result = result | processed_predicates
 
         return result
 
-- 
GitLab