[all-commits] [llvm/llvm-project] 72121a: [SCCP] Use range info to prove AddInst has NSW flag.

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Jan 27 06:10:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72121a20cda4dc91d0ef5548f93046e71c5ec6f6
      https://github.com/llvm/llvm-project/commit/72121a20cda4dc91d0ef5548f93046e71c5ec6f6
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-01-27 (Fri, 27 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SCCPSolver.cpp
    M llvm/test/Transforms/SCCP/add-nuw-nsw-flags.ll
    M llvm/test/Transforms/SCCP/binaryops-constexprs.ll
    M llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll
    M llvm/test/Transforms/SCCP/conditions-ranges.ll
    M llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
    M llvm/test/Transforms/SCCP/ip-constant-ranges.ll
    M llvm/test/Transforms/SCCP/ip-ranges-binaryops.ll
    M llvm/test/Transforms/SCCP/ip-ranges-casts.ll
    M llvm/test/Transforms/SCCP/ip-ranges-phis.ll
    M llvm/test/Transforms/SCCP/ip-ranges-select.ll
    M llvm/test/Transforms/SCCP/return-argument.ll
    M llvm/test/Transforms/SCCP/return-constants.ll
    M llvm/test/Transforms/SCCP/widening.ll

  Log Message:
  -----------
  [SCCP] Use range info to prove AddInst has NSW flag.

This patch updates SCCP to use the value ranges of AddInst operands to
try to prove the AddInst does not overflow in the signed sense and
adds the NSW flag. The reasoning is done with
makeGuaranteedNoWrapRegion (thanks @nikic for point it out!).

Follow-ups will include extending this to more
OverflowingBinaryOperators.

Depends on D142387.

Reviewed By: nikic

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




More information about the All-commits mailing list