[PATCH] D143373: [InstCombine] fold icmp of the sum of ext bool based on limited range
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 12:53:12 PST 2023
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5836
+ // when C == -1 means, X == false ,Y == true
+ // C == 0 means , X == Y
+ // C == 1 means, X == true, Y == false
----------------
This description does not make sense to me. We need to specify the predicate along with the constant value to know the correct transform?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5849
+ return BinaryOperator::CreateAnd(Builder.CreateNot(X), Y);
+ if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT)
+ return BinaryOperator::CreateOr(X, Builder.CreateNot(Y));
----------------
Include "ULT" here?
================
Comment at: llvm/test/Transforms/InstCombine/icmp-range.ll:662
define i1 @zext_sext_add_icmp_sgt_minus1(i1 %a, i1 %b) {
; CHECK-LABEL: @zext_sext_add_icmp_sgt_minus1(
----------------
Where do we transform this pattern? Is it possible that the existing code can be extended to handle more predicates?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143373/new/
https://reviews.llvm.org/D143373
More information about the llvm-commits
mailing list