[all-commits] [llvm/llvm-project] d57e9a: [IndVarSimplify] Don't replace IV user with unsafe...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Jun 23 03:53:50 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d57e9aca0137dd088825abd80ea4a616e49d17ed
      https://github.com/llvm/llvm-project/commit/d57e9aca0137dd088825abd80ea4a616e49d17ed
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    M llvm/test/Transforms/IndVarSimplify/X86/pr45360.ll

  Log Message:
  -----------
  [IndVarSimplify] Don't replace IV user with unsafe loop-invariant (PR45360)

Summary:
As [[ https://bugs.llvm.org/show_bug.cgi?id=45360 | PR45360 ]] reports,
with new cost-model we can sometimes end up being able to expand `udiv`/`urem` instructions.
And that exposes at least one instance of when we do that
regardless of whether or not it is safe to do.
In this particular case, it's `SimplifyIndvar::replaceIVUserWithLoopInvariant()`.

It seems to me, we simply need to check with `isSafeToExpandAt()` first.

The test isn't great. I'm not sure how to make it only run `-indvars`.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=45360 | PR45360 ]].

Reviewers: mkazantsev, reames, helloqirun

Reviewed By: mkazantsev

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list