[llvm] [InstCombine] Fold shift of boolean zext to logic sequence (PR #180596)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 05:59:56 PST 2026
================
@@ -3086,14 +3086,37 @@ static Value *createLogicFromTable(const std::bitset<4> &Table, Value *Op0,
return nullptr;
}
+/// Try to match V as a boolean-controlled value: either
+/// select i1 Cond, C_true, C_false
+/// zext i1 Cond (equivalent to select i1 Cond, 1, 0)
+/// sext i1 Cond (equivalent to select i1 Cond, -1, 0)
+static bool matchBooleanMap(Value *V, Value *&Cond, Constant *&TrueC,
+ Constant *&FalseC) {
----------------
nikic wrote:
It would probably a good idea to move something like this into PatternMatch as a followup, so we can reuse it in other places like foldBinOpOfSelectAndCastOfSelectCondition.
https://github.com/llvm/llvm-project/pull/180596
More information about the llvm-commits
mailing list