[all-commits] [llvm/llvm-project] c86e1c: [SCEVExpander] Simplify pointer overflow check

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Sep 2 11:16:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c86e1ce73bb6d70d255df9bf7700d09db07e7af8
      https://github.com/llvm/llvm-project/commit/c86e1ce73bb6d70d255df9bf7700d09db07e7af8
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-ni.ll
    M llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
    M llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll

  Log Message:
  -----------
  [SCEVExpander] Simplify pointer overflow check

This is a followup to D104662 to generate slightly nicer code for
pointer overflow checks. Bypass expandAddToGEP and instead
explicitly generate i8 GEPs. This saves some bitcasts and negates
the value in a more obvious way. In particular, this prevents SCEV
from looking through the umul.with.overflow, same as in the integer
case.

The wrapping-pointer-ni.ll test deserves a comment: Previously,
this generated a typed GEP which used the umulo argument rather
than the multiplication result. This results in more compact IR in
that case, but effectively does the multiplication twice, the
second one is just hidden in the GEP. Reusing the umulo result
seems pretty reasonable to me.

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




More information about the All-commits mailing list