[llvm] [InstCombine] Fold `select Cond, not X, X` into `Cond ^ X` (PR #90089)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon May 27 11:54:24 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)
----------------
dtcxzyw wrote:
I can simplify the implementation to just handle `select Cond, icmp X, C1, icmp X, C2`, which covers all the motivating cases.
https://github.com/llvm/llvm-project/pull/90089
More information about the llvm-commits
mailing list