[PATCH] D59506: [ValueTracking][InstSimplify] Support min/max selects in computeConstantRange()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 12:43:35 PDT 2019


nikic created this revision.
nikic added reviewers: spatel, tejohnson, lebedev.ri.
Herald added subscribers: llvm-commits, jdoerfert, hiraditya.
Herald added a project: LLVM.

Add support for min/max flavor selects in computeConstantRange(), which allows us to fold comparisons of a min/max against a constant in InstSimplify. This was suggested by @spatel as an alternative approach to D59378 <https://reviews.llvm.org/D59378>. I've also added the infinite looping test from that revision here.

My main concern here would be compile time, I don't really have a handle on how expensive matchSelectPattern() is and whether it's appropriate to use in code used by InstSimplify.


Repository:
  rL LLVM

https://reviews.llvm.org/D59506

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/InstCombine/minmax-fold.ll
  llvm/test/Transforms/InstSimplify/cmp_of_min_max.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59506.191148.patch
Type: text/x-patch
Size: 4960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190318/5f9feb63/attachment.bin>


More information about the llvm-commits mailing list