[PATCH] D142387: [SCCP] Use range info to prove AddInst has NUW flag.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 10:47:28 PST 2023


fhahn created this revision.
fhahn added reviewers: nikic, spatel, efriedma.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

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

Follow-ups will include adding NSW and extension to more
OverflowingBinaryOperators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142387

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142387.491453.patch
Type: text/x-patch
Size: 22186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/88493f5e/attachment.bin>


More information about the llvm-commits mailing list