Index: lib/Analysis/InstructionSimplify.cpp =================================================================== --- lib/Analysis/InstructionSimplify.cpp +++ lib/Analysis/InstructionSimplify.cpp @@ -1313,7 +1313,7 @@ ICmpInst::isUnsigned(UnsignedPred)) ; else if (match(UnsignedICmp, - m_ICmp(UnsignedPred, m_Value(Y), m_Specific(X))) && + m_ICmp(UnsignedPred, m_Specific(Y), m_Value(X))) && ICmpInst::isUnsigned(UnsignedPred)) UnsignedPred = ICmpInst::getSwappedPredicate(UnsignedPred); else Index: test/Transforms/InstSimplify/AndOrXor.ll =================================================================== --- test/Transforms/InstSimplify/AndOrXor.ll +++ test/Transforms/InstSimplify/AndOrXor.ll @@ -375,9 +375,7 @@ define i1 @and_icmp2(i32 %x, i32 %y) { ; CHECK-LABEL: @and_icmp2( ; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[X]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: ret i1 [[TMP3]] +; CHECK-NEXT: ret i1 [[TMP1]] ; %1 = icmp ugt i32 %x, %y %2 = icmp ne i32 %x, 0 @@ -397,10 +395,7 @@ define i1 @and_icmp4(i32 %x, i32 %y) { ; CHECK-LABEL: @and_icmp4( -; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[X]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: ret i1 [[TMP3]] +; CHECK-NEXT: ret i1 false ; %1 = icmp ugt i32 %x, %y %2 = icmp eq i32 %x, 0 @@ -421,10 +416,8 @@ define i1 @or_icmp2(i32 %x, i32 %y) { ; CHECK-LABEL: @or_icmp2( -; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[X]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = or i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: ret i1 [[TMP3]] +; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[X:%.*]], 0 +; CHECK-NEXT: ret i1 [[TMP1]] ; %1 = icmp ugt i32 %x, %y %2 = icmp ne i32 %x, 0 @@ -444,10 +437,7 @@ define i1 @or_icmp4(i32 %x, i32 %y) { ; CHECK-LABEL: @or_icmp4( -; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[X]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = or i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: ret i1 [[TMP3]] +; CHECK-NEXT: ret i1 true ; %1 = icmp ule i32 %x, %y %2 = icmp ne i32 %x, 0 @@ -469,9 +459,7 @@ define i1 @or_icmp6(i32 %x, i32 %y) { ; CHECK-LABEL: @or_icmp6( ; CHECK-NEXT: [[TMP1:%.*]] = icmp ule i32 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[X]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = or i1 [[TMP1]], [[TMP2]] -; CHECK-NEXT: ret i1 [[TMP3]] +; CHECK-NEXT: ret i1 [[TMP1]] ; %1 = icmp ule i32 %x, %y %2 = icmp eq i32 %x, 0