[all-commits] [llvm/llvm-project] fca021: [indvars] Canonicalize exit conditions to unsigned...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Oct 19 11:49:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fca0218875f5117110d38b9cd7503bc2789693d3
      https://github.com/llvm/llvm-project/commit/fca0218875f5117110d38b9cd7503bc2789693d3
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-10-19 (Tue, 19 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
    M llvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll

  Log Message:
  -----------
  [indvars] Canonicalize exit conditions to unsigned using range info

This patch duplicates a bit of logic we apply to comparisons encountered during the IV users walk to conditions which feed exit conditions. Why? simplifyAndExtend has a very limited list of users it walks. In particular, in the examples is stops at the zext and never visits the icmp. (Because we can't fold the zext to an addrec yet in SCEV.) Being willing to visit when we haven't simplified regresses multiple tests (seemingly because of less optimal results when computing trip counts).

Note that this can be trivially extended to multiple exiting blocks. I'm leaving that to a future patch (solely to cut down on the number of versions of the same code in review at once.)

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




More information about the All-commits mailing list