[InstCombine] fold clamp to 2 values from min/max intrinsics
authorSanjay Patel <spatel@rotateright.com>
Tue, 27 Apr 2021 19:14:29 +0000 (15:14 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 27 Apr 2021 19:35:49 +0000 (15:35 -0400)
commit025bb52903792de3dd29667d42c97fdf13a00f2b
tree2b0c153cfa57754f3bbd9620d037c339230f232c
parent4fc068eb82c8190308b3e09c2aecbd1a635317f8
[InstCombine] fold clamp to 2 values from min/max intrinsics

The "select" versions of these folds is also missing and can
cause infinite loops as shown in:
https://llvm.org/PR48900
...but it seems easier to match these as max/min as a first fix.

https://alive2.llvm.org/ce/z/wv-_dT
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/minmax-intrinsics.ll