[PATCH] D71936: [SCCP] Use constant ranges for binary operators.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 27 08:36:00 PST 2019


fhahn created this revision.
fhahn added reviewers: davide, efriedma, mssimpso.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

If one of the operands of a binary operator is a constant range, we can
use ConstantRange::binaryOp to approximate the result.

We still handle single element constant ranges as we did previously,
with ConstantExpr::get(), because ConstantRange::binaryOp still gives
worse results in a few cases for single element ranges.

Also note that we bail out early if any of the operands is still unknown.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71936

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/test/Transforms/SCCP/ip-ranges-binaryops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71936.235428.patch
Type: text/x-patch
Size: 7164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191227/0a02cafc/attachment.bin>


More information about the llvm-commits mailing list