diff options
author | Alex MacLean <amaclean@nvidia.com> | 2025-06-06 12:44:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-06 12:44:04 -0700 |
commit | 107601ed063f9e92aba61ea4f2a36c372127a82a (patch) | |
tree | c352ee7f1bc45c52e24b5e41de452a23f190ab51 /clang/lib/CIR/CodeGen/CIRGenModule.cpp | |
parent | bc7f1eadbf8bd3377d8fa121f3b6072ec7601724 (diff) | |
download | llvm-107601ed063f9e92aba61ea4f2a36c372127a82a.zip llvm-107601ed063f9e92aba61ea4f2a36c372127a82a.tar.gz llvm-107601ed063f9e92aba61ea4f2a36c372127a82a.tar.bz2 |
[InstCombine] Allow min/max in constant BOp min/max folding (#142878)
Extend folding for `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2)
BOp C1` to allow min and max as `BOp`. This ensures a constant clamping
pattern is folded into a pair of min/max instructions. Here is a
simplified example of a case where this folding is not occurring
currently.
int clampToU8(int v) {
if (v < 0) return 0;
if (v > 255) return 255;
return v;
}
https://godbolt.org/z/78jhKPWbv
Generic proof: https://alive2.llvm.org/ce/z/cdpLYy
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
0 files changed, 0 insertions, 0 deletions