summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp2
-rw-r--r--llvm/test/Transforms/InstSimplify/AndOrXor.ll24
2 files changed, 7 insertions, 19 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index ffcffc7d6d2..f1bfa33276b 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1313,7 +1313,7 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
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
diff --git a/llvm/test/Transforms/InstSimplify/AndOrXor.ll b/llvm/test/Transforms/InstSimplify/AndOrXor.ll
index 9447f0671e4..09181bf2b87 100644
--- a/llvm/test/Transforms/InstSimplify/AndOrXor.ll
+++ b/llvm/test/Transforms/InstSimplify/AndOrXor.ll
@@ -375,9 +375,7 @@ define i1 @and_icmp1(i32 %x, i32 %y) {
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_icmp3(i32 %x, i32 %y) {
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_icmp1(i32 %x, i32 %y) {
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_icmp3(i32 %x, i32 %y) {
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_icmp5(i32 %x, i32 %y) {
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
OpenPOWER on IntegriCloud