[PATCH] D43835: Simplify more cases of logical ops of masked icmps.
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 8 09:02:25 PST 2018
davidxl added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:309
/// Return the set of pattern classes (from MaskedICmpType) that both LHS and
/// RHS satisfy.
+static
----------------
Update the comment since return type changes. Also document parameters LHS, RHS, PredL and PredR.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:438
+
+static Value * foldLogOpOfMaskedICmps_NotAllZeros_BMask_Mixed(
+ ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
----------------
Document this method with a small example.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:444
+ // We are given the canonical form:
+ // (icmp ne (A & B), 0) && (icmp eq (A & D), E).
+ // where D & E == E.
----------------
&& -> &
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:448
+ // If IsAnd is false, we get it in negated form:
+ // (icmp eq (A & B), 0) || (icmp ne (A & D), E) ->
+ // !((icmp ne (A & B), 0) && (icmp eq (A & D), E)).
----------------
|| -> |
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:551
+
+static Value *foldLogOpOfMaskedICmpsAsymmetric(
+ ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
----------------
Add function documentation.
================
Comment at: test/Transforms/InstCombine/icmp-logical.ll:204
+
+; ((X & 12) != 0 && (X & 7) == 1) -> (X && 15) == 9
+define i1 @and_masked_icmps_mask_notallzeros_bmask_mixed_1(i32 %x) {
----------------
x&&15 --> x&15
================
Comment at: test/Transforms/InstCombine/icmp-logical.ll:341
+
+; ((X & 6) != 0 && (X & 15) == 8) -> false
+define i1 @and_masked_icmps_mask_notallzeros_bmask_mixed_7b(i32 %x) {
----------------
&& --> &
Similarly, || --> | in other places.
Repository:
rL LLVM
https://reviews.llvm.org/D43835
More information about the llvm-commits
mailing list