Index: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp =================================================================== --- lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2487,7 +2487,8 @@ Value *LHS0 = LHS->getOperand(0), *LHS1 = LHS->getOperand(1); Value *RHS0 = RHS->getOperand(0), *RHS1 = RHS->getOperand(1); if ((LHS->hasOneUse() || RHS->hasOneUse()) && - LHS0->getType() == RHS0->getType()) { + LHS0->getType() == RHS0->getType() && + LHS0->getType()->isIntOrIntVectorTy()) { // (X > -1) ^ (Y > -1) --> (X ^ Y) < 0 // (X < 0) ^ (Y < 0) --> (X ^ Y) < 0 if ((PredL == CmpInst::ICMP_SGT && match(LHS1, m_AllOnes()) && Index: test/Transforms/InstCombine/xor-icmps.ll =================================================================== --- test/Transforms/InstCombine/xor-icmps.ll +++ test/Transforms/InstCombine/xor-icmps.ll @@ -158,3 +158,16 @@ ret i1 %E } +define i1 @xor_icmp_ptr(i8* %c, i8* %d) { +; CHECK-LABEL: @xor_icmp_ptr( +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8* [[C:%.*]], null +; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8* [[D:%.*]], null +; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[CMP]], [[CMP1]] +; CHECK-NEXT: ret i1 [[XOR]] +; + %cmp = icmp slt i8* %c, null + %cmp1 = icmp slt i8* %d, null + %xor = xor i1 %cmp, %cmp1 + ret i1 %xor +} +