[llvm] [InstCombine] Fold `select (A &/| B), T, F` if `select B, T, F` is foldable (PR #76621)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 30 13:18:09 PST 2023


================
@@ -303,7 +303,7 @@ define i1 @and_logic_and_logic_or_not_one_use(i1 %c, i1 %a, i1 %b) {
 ; CHECK-LABEL: @and_logic_and_logic_or_not_one_use(
 ; CHECK-NEXT:    [[AC:%.*]] = and i1 [[A:%.*]], [[C:%.*]]
 ; CHECK-NEXT:    [[BC:%.*]] = select i1 [[B:%.*]], i1 [[C]], i1 false
-; CHECK-NEXT:    [[OR:%.*]] = select i1 [[BC]], i1 true, i1 [[AC]]
+; CHECK-NEXT:    [[OR:%.*]] = select i1 [[B]], i1 [[C]], i1 [[AC]]
----------------
nikic wrote:

(Or maybe if the operand is already constant?)

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


More information about the llvm-commits mailing list