[llvm] [InstCombine] Fold shift of boolean zext to logic sequence (PR #180596)

Gergo Stomfai via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 10:36:50 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) {
----------------
stomfaig wrote:

I assume you mean in a followup patch. I'll open a pr once this is closed.

https://github.com/llvm/llvm-project/pull/180596


More information about the llvm-commits mailing list