HomePhabricator

[LoopInterchange] Fix legality for triangular loops

Authored by congzhe on May 11 2021, 3:34 PM.

Description

[LoopInterchange] Fix legality for triangular loops

This is a bug fix in legality check.

When we encounter triangular loops such as the following form:

for (int i = 0; i < m; i++)
  for (int j = 0; j < i; j++), or

for (int i = 0; i < m; i++)
  for (int j = 0; j*i < n; j++),

we should not perform interchange since the number of executions
of the loop body will be different before and after interchange,
resulting in incorrect results.

Reviewed By: bmahjour

Differential Revision: https://reviews.llvm.org/D101305

Details

Committed
congzheMay 11 2021, 3:36 PM
Reviewer
bmahjour
Differential Revision
D101305: [LoopInterchange] Fix legality for triangular loops
Parents
rG8280ece0c972: [Coverage] Support overriding compilation directory
Branches
Unknown
Tags
Unknown