[llvm] [InstCombine] Fold `select Cond, not X, X` into `Cond ^ X` (PR #90089)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 19:39:48 PDT 2024


================
@@ -3985,5 +3985,10 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
     }
   }
 
+  if (CondVal->getType() == SI.getType() && impliesPoison(FalseVal, TrueVal) &&
+      isImpliedCondition(FalseVal, TrueVal, DL, /*LHSIsTrue=*/true) == false &&
+      isImpliedCondition(FalseVal, TrueVal, DL, /*LHSIsTrue=*/false) == true)
----------------
nikic wrote:

Hm, I guess it's fine as FalseVal is the value we're replacing with.

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


More information about the llvm-commits mailing list