[PATCH] D125372: [SCEVExpander] Expand umin_seq using freeze
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 03:57:54 PDT 2022
nikic created this revision.
nikic added reviewers: fhahn, reames, lebedev.ri, nlopes.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`%x umin_seq %y` is currently expanded to `%x == 0 ? 0 : umin(%x, %y)`. This patch changes the expansion to `umin(%x, freeze %y)` instead (https://alive2.llvm.org/ce/z/wujUhp).
The motivating for this change are the test cases affected by D124910 <https://reviews.llvm.org/D124910>, where the freeze expansion ultimately produces better optimization results. This is largely because `(%x umin_seq %y) == %x` is a common expansion pattern, which reliably optimizes in freeze representation, but only sometimes with the zero comparison (in particular, if `%x == 0` can fold to something else, we generally won't be able to cover reasonable code from this.)
https://reviews.llvm.org/D125372
Files:
llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
llvm/test/Transforms/IndVarSimplify/exit-count-select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125372.428617.patch
Type: text/x-patch
Size: 6324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220511/60f63eea/attachment.bin>
More information about the llvm-commits
mailing list