[PATCH] D77808: [SCCP] Use conditional info with AND/OR branch conditions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 12:58:26 PDT 2020


fhahn updated this revision to Diff 257454.
fhahn marked an inline comment as done.
fhahn added a comment.

Updated on top of D78133 <https://reviews.llvm.org/D78133>.

Unfortunately it seems like this change is not strictly beneficial in some cases and the additional information might destroy some useful information. For example, consider the code below

    %c.ne = icmp ne i32 %x, 0
    %c.slt = icmp slt i32 %x, 255
    %and= and i1 %c.ne, c.slt%
    br i1 %and, label %true, label %false
  
  true:
    %c.ne.2 = icmp eq i32 %x, 0
    call void @use(i1 %c.ne.2)

With the change, we won't be able to simplify %c.ne.2 to false, because we combine the range from %x != 0 with %x < 255, which results in a range %x < 255 and we cannot represent that the range also excludes 0.

It seems like the change is overall neutral on the test-suite, but there are a few cases where fewer constants are replaced unfortunately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77808/new/

https://reviews.llvm.org/D77808

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77808.257454.patch
Type: text/x-patch
Size: 4688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/f1e89a4e/attachment.bin>


More information about the llvm-commits mailing list