[PATCH] D83640: [PredicateInfo] Add a common method to interpret predicate as cmp constraint

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 12 01:25:45 PDT 2020


nikic created this revision.
nikic added a reviewer: fhahn.
Herald added subscribers: llvm-commits, hiraditya, Prazek.
Herald added a project: LLVM.

Both users of predicteinfo (NewGVN and SCCP) are interested in getting a cmp constraint on the predicated value. They currently implement separate logic for this. This patch adds a common method for this in PredicateWithCondition (it would be nice to drop the PredicateBase/PredicateWithCondition split ... I saw you had a patch for that).

This enables a missing bit of PredicateInfo handling in SCCP: Now the predicate on the condition itself is also used. For switches it means we know that the switched-on value is the same as the case value. For assumes/branches we know that the condition is true or false.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83640

Files:
  llvm/include/llvm/Transforms/Utils/PredicateInfo.h
  llvm/lib/Transforms/Scalar/NewGVN.cpp
  llvm/lib/Transforms/Scalar/SCCP.cpp
  llvm/lib/Transforms/Utils/PredicateInfo.cpp
  llvm/test/Transforms/SCCP/predicateinfo-cond.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83640.277277.patch
Type: text/x-patch
Size: 13138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200712/e1582f3b/attachment.bin>


More information about the llvm-commits mailing list