[PATCH] D145230: [ScalarEvolution] Apply loop guards against min/max for its arguments

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 5 21:41:00 PST 2023


mkazantsev added a comment.

So far plans look follwing:

1. Refactor switch cases into fallthroughs;
2. Then, make an NFC that calls a function. Instead of

  RewrittenRHS = getUMaxExpr(RewrittenLHS, RHS);

smth like

  RewrittenRHS = AddRewrites(RewrittenLHS, RHS);

3. Into this function, add handling of min/max (non-recursive stack-based traversal). The returned value should be the rewrite of original `RewrittenLHS` no matter if it's a min or not.

As a side thing - add checks that, whenever you compute `RHS + - 1`, it is not a `MAX/MIN` int respectively. In this case we should not rewrite anything.


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

https://reviews.llvm.org/D145230



More information about the llvm-commits mailing list