Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: Patch Guards.simplify_and #2334

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions devito/ir/support/guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,16 @@ def simplify_and(relation, v):
for a in candidates:
if a.lhs is v.lhs:
covered = True
if type(a) in (Gt, Ge) and v.rhs > a.rhs:
new_args.append(v)
elif type(a) in (Lt, Le) and v.rhs < a.rhs:
new_args.append(v)
else:
try:
if type(a) in (Gt, Ge) and v.rhs > a.rhs:
new_args.append(v)
elif type(a) in (Lt, Le) and v.rhs < a.rhs:
new_args.append(v)
else:
new_args.append(a)
except TypeError:
# E.g., `v.rhs = const + z_M` and `a.rhs = z_M`, so the inequalities
# above are not evaluable to True/False
new_args.append(a)
else:
new_args.append(a)
Expand Down
Loading