File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
lib/Transforms/InstCombine
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1448,6 +1448,7 @@ Instruction *InstCombinerImpl::foldSelectEqualityTest(SelectInst &Sel) {
14481448 m_c_SpecificICmp (ICmpInst::ICMP_EQ, m_Specific (X), m_Specific (Y))))
14491449 return nullptr ;
14501450
1451+ cast<ICmpInst>(XeqY)->setSameSign (false );
14511452 return replaceInstUsesWith (Sel, XeqY);
14521453}
14531454
Original file line number Diff line number Diff line change @@ -33,6 +33,22 @@ entry:
3333 ret i1 %equal
3434}
3535
36+ define i1 @icmp_equality_test_constant_samesign (i42 %X , i42 %Y ) {
37+ ; CHECK-LABEL: @icmp_equality_test_constant_samesign(
38+ ; CHECK-NEXT: entry:
39+ ; CHECK-NEXT: [[XEQY:%.*]] = icmp eq i42 [[X:%.*]], [[Y:%.*]]
40+ ; CHECK-NEXT: ret i1 [[XEQY]]
41+ ;
42+ entry:
43+ %XeqC = icmp eq i42 %X , -42
44+ %YeqC = icmp eq i42 %Y , -42
45+ %XeqY = icmp samesign eq i42 %X , %Y
46+ %not.YeqC = xor i1 %YeqC , true
47+ %and = select i1 %not.YeqC , i1 %XeqY , i1 false
48+ %equal = select i1 %XeqC , i1 %YeqC , i1 %and
49+ ret i1 %equal
50+ }
51+
3652define i1 @icmp_equality_test_swift_optional_pointers (i64 %X , i64 %Y ) {
3753; CHECK-LABEL: @icmp_equality_test_swift_optional_pointers(
3854; CHECK-NEXT: entry:
You can’t perform that action at this time.
0 commit comments