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

CongzheUalberta via All-commits all-commits at lists.llvm.org
Tue May 11 08:06:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 29342291d25b83da97e74d75004b177ba41114fc
      https://github.com/llvm/llvm-project/commit/29342291d25b83da97e74d75004b177ba41114fc
  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