[PATCH] D84547: [ConstraintElimination] Add constraint elimination pass (WIP).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 25 10:26:39 PDT 2020


fhahn added a comment.

In D84547#2173510 <https://reviews.llvm.org/D84547#2173510>, @efriedma wrote:

> Noting else in the compiler does this sort of symbolic reasoning, I think, so this is sort of a new space.  The way the constraint system is constructed seems a little complicated, but I'm not sure how much you could simplify it.


Are you referring to the way comparisons are converted to constraints (`getConstraint`) or the the iteration over the BBs? `getConstraint` is definitely a bit ugly at the moment and could hopefully be improved.

> What sort of patterns in realistic code are you hoping to catch?  This seems like the sort of thing that could come up with array bounds checks, I guess?

Yes, I mainly want to improve elimination of various kinds of bounds checks. As is, ~380 conditions are removed in an -O3 -flto build of MultiSource/SPEC2006/SPEC2000, but it currently only leads to 4 binaries with differences. So it might not help a lot with regular C/C++ codebases, but could have a big impact on code with redundant runtime checks and cases where people try to make the compiler look stupid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84547





More information about the llvm-commits mailing list