[all-commits] [llvm/llvm-project] 107601: [InstCombine] Allow min/max in constant BOp min/ma...
Alex MacLean via All-commits
all-commits at lists.llvm.org
Fri Jun 6 12:44:26 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 107601ed063f9e92aba61ea4f2a36c372127a82a
https://github.com/llvm/llvm-project/commit/107601ed063f9e92aba61ea4f2a36c372127a82a
Author: Alex MacLean <amaclean at nvidia.com>
Date: 2025-06-06 (Fri, 06 Jun 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
M llvm/test/Transforms/InstCombine/canonicalize-const-to-bop.ll
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list