[all-commits] [llvm/llvm-project] 2e01ce: [IndVars] Recognize 'sub nuw' expressed as 'add' f...

max-azul via All-commits all-commits at lists.llvm.org
Wed Nov 11 20:49:40 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e01ceafaa1ceef2428182128c3654bab56a0a4f
      https://github.com/llvm/llvm-project/commit/2e01ceafaa1ceef2428182128c3654bab56a0a4f
  Author: Max Kazantsev <mkazantsev at azul.com>
  Date:   2020-11-12 (Thu, 12 Nov 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    M llvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll

  Log Message:
  -----------
  [IndVars] Recognize 'sub nuw' expressed as 'add' for widening

InstCombine canonicalizes 'sub nuw' instructions to 'add' without the
`nuw` flag. The typical case where we see it is decrementing induction
variables. For them, IndVars fails to prove that it's legal to widen them,
and inserts unprofitable `zext`'s.

This patch adds recognition of such pattern using SCEV.

Differential Revision: https://reviews.llvm.org/D89550
Reviewed By: fhahn, skatkov




More information about the All-commits mailing list