[all-commits] [llvm/llvm-project] 40e3aa: [LoopInterchange] Fix legality for triangular loops

CongzheUalberta via All-commits all-commits at lists.llvm.org
Tue May 11 15:37:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40e3aa39bd68b554808ddcb096a63919f53f2e43
      https://github.com/llvm/llvm-project/commit/40e3aa39bd68b554808ddcb096a63919f53f2e43
  Author: Congzhe Cao <congzhe.cao at huawei.com>
  Date:   2021-05-11 (Tue, 11 May 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopInterchange.cpp
    A llvm/test/Transforms/LoopInterchange/inner-indvar-depend-on-outer-indvar.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list