diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp --- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp +++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp @@ -1069,7 +1069,8 @@ static bool checkAndReplaceCondition( CmpInst *Cmp, ConstraintInfo &Info, unsigned NumIn, unsigned NumOut, Instruction *ContextInst, Module *ReproducerModule, - ArrayRef ReproducerCondStack, DominatorTree &DT) { + ArrayRef ReproducerCondStack, DominatorTree &DT, + SmallVectorImpl &ToRemove) { auto ReplaceCmpWithConstant = [&](CmpInst *Cmp, bool IsTrue) { generateReproducer(Cmp, ReproducerModule, ReproducerCondStack, Info, DT); Constant *ConstantC = ConstantInt::getBool( @@ -1090,6 +1091,8 @@ return !II || II->getIntrinsicID() != Intrinsic::assume; }); NumCondsRemoved++; + if (Cmp->use_empty()) + ToRemove.push_back(Cmp); return true; }; @@ -1355,7 +1358,7 @@ } else if (auto *Cmp = dyn_cast(Inst)) { bool Simplified = checkAndReplaceCondition( Cmp, Info, CB.NumIn, CB.NumOut, CB.getContextInst(), - ReproducerModule.get(), ReproducerCondStack, S.DT); + ReproducerModule.get(), ReproducerCondStack, S.DT, ToRemove); if (!Simplified && match(CB.getContextInst(), m_LogicalAnd(m_Value(), m_Specific(Inst)))) { Simplified = diff --git a/llvm/test/Transforms/ConstraintElimination/add-nsw.ll b/llvm/test/Transforms/ConstraintElimination/add-nsw.ll --- a/llvm/test/Transforms/ConstraintElimination/add-nsw.ll +++ b/llvm/test/Transforms/ConstraintElimination/add-nsw.ll @@ -64,16 +64,12 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = add nsw i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = add nsw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = add nsw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = add nsw i8 [[START]], 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] @@ -120,10 +116,8 @@ ; CHECK-NEXT: br i1 [[AND_1]], label [[IF_THEN_2:%.*]], label [[IF_END]] ; CHECK: if.then.2: ; CHECK-NEXT: [[ADD_0:%.*]] = add nsw i8 [[A]], [[B]] -; CHECK-NEXT: [[T_0:%.*]] = icmp sge i8 [[ADD_0]], [[C]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[ADD_1:%.*]] = add nsw i8 [[A]], [[A]] -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i8 [[ADD_0]], [[C]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[ADD_2:%.*]] = add nsw i8 [[A]], [[D:%.*]] ; CHECK-NEXT: [[C_4:%.*]] = icmp sge i8 [[ADD_2]], [[C]] @@ -218,10 +212,8 @@ ; CHECK-NEXT: [[C_4:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: [[START_3:%.*]] = add nsw i8 [[START]], -3 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = add nsw i8 [[START]], -4 -; CHECK-NEXT: [[T_2:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; @@ -254,7 +246,6 @@ ; CHECK-NEXT: [[ADD_EXT:%.*]] = add nsw i16 [[START_EXT]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i16 [[ADD_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[T:%.*]] = icmp ult i16 [[START_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: ret i1 true ; entry: @@ -276,7 +267,6 @@ ; CHECK-NEXT: [[ADD:%.*]] = add nsw i8 [[START]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[ADD]], [[HIGH:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[T:%.*]] = icmp ult i8 [[START]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; entry: @@ -316,7 +306,6 @@ ; CHECK-NEXT: [[ADD_EXT:%.*]] = add nsw i16 [[START_EXT]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i16 [[ADD_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[T:%.*]] = icmp ult i8 [[START]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; entry: @@ -338,7 +327,6 @@ ; CHECK-NEXT: [[ADD_EXT:%.*]] = add nsw i16 [[START_EXT]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i16 [[ADD_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[F:%.*]] = icmp uge i16 [[START_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: ret i1 false ; entry: @@ -360,7 +348,6 @@ ; CHECK-NEXT: [[ADD:%.*]] = add nsw i8 [[START]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[ADD]], [[HIGH:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[F:%.*]] = icmp uge i8 [[START]], [[HIGH]] ; CHECK-NEXT: ret i1 false ; entry: @@ -382,7 +369,6 @@ ; CHECK-NEXT: [[ADD_EXT:%.*]] = add nsw i16 [[START_EXT]], 3 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i16 [[ADD_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) -; CHECK-NEXT: [[C:%.*]] = icmp uge i8 [[START]], [[HIGH]] ; CHECK-NEXT: ret i1 false ; entry: @@ -453,7 +439,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i16 [[ADD_EXT]], [[HIGH_EXT]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[ADD_2:%.*]] = add nsw i16 [[START_EXT]], 2 -; CHECK-NEXT: [[C:%.*]] = icmp ult i16 [[ADD_2]], [[HIGH_EXT]] ; CHECK-NEXT: ret i1 true ; entry: @@ -477,7 +462,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[ADD]], [[HIGH:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[ADD_2:%.*]] = add nsw i8 [[START]], 2 -; CHECK-NEXT: [[C:%.*]] = icmp ult i8 [[ADD_2]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; entry: @@ -679,7 +663,6 @@ ; CHECK-NEXT: [[OFF_1_ULT:%.*]] = icmp ult i8 [[OFF_1]], [[OFF_2]] ; CHECK-NEXT: call void @llvm.assume(i1 [[OFF_1_ULT]]) ; CHECK-NEXT: [[ADD_OFF_2:%.*]] = add nsw i8 [[START]], [[OFF_1]] -; CHECK-NEXT: [[C:%.*]] = icmp ult i8 [[ADD_OFF_2]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/add-nuw.ll b/llvm/test/Transforms/ConstraintElimination/add-nuw.ll --- a/llvm/test/Transforms/ConstraintElimination/add-nuw.ll +++ b/llvm/test/Transforms/ConstraintElimination/add-nuw.ll @@ -10,16 +10,12 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ult i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = add nuw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ult i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = add nuw i8 [[START]], 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp ult i8 [[START_4]], [[HIGH]] @@ -61,19 +57,14 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ule i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = add nuw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = add nuw i8 [[START]], 4 -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_5:%.*]] = add nuw i8 [[START]], 5 ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[START_5]], [[HIGH]] @@ -120,19 +111,14 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = add nuw i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp ugt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = add nuw i8 [[START]], 4 -; CHECK-NEXT: [[F_4:%.*]] = icmp ugt i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_5:%.*]] = add nuw i8 [[START]], 5 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[START_5]], [[HIGH]] @@ -183,16 +169,12 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = add nuw i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = add nuw i8 [[START]], 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 [[START_4]], [[HIGH]] @@ -251,10 +233,8 @@ ; CHECK-NEXT: br i1 [[AND_1]], label [[IF_THEN_2:%.*]], label [[IF_END]] ; CHECK: if.then.2: ; CHECK-NEXT: [[ADD_0:%.*]] = add nuw i8 [[A]], [[B]] -; CHECK-NEXT: [[T_0:%.*]] = icmp uge i8 [[ADD_0]], [[C]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw i8 [[A]], [[A]] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD_0]], [[C]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw i8 [[A]], [[D:%.*]] ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 [[ADD_2]], [[C]] @@ -343,7 +323,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[I]], [[ADD]] ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[T:%.*]] = icmp ule i8 [[N]], 1 ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: [[F:%.*]] = icmp ule i8 [[N]], 1 @@ -402,7 +381,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[I]], [[ADD]] ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[T:%.*]] = icmp ule i8 [[N]], 2 ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: [[F:%.*]] = icmp ule i8 [[N]], 2 @@ -462,7 +440,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i16 0, [[NEG2]] ; CHECK-NEXT: br i1 [[C_1]], label [[EXIT_1:%.*]], label [[EXIT_2:%.*]] ; CHECK: exit.1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i16 [[A]], 0 ; CHECK-NEXT: ret i1 false ; CHECK: exit.2: ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i16 [[A]], 0 @@ -516,13 +493,11 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[NEG2]], -2 ; CHECK-NEXT: br i1 [[C_1]], label [[EXIT_1:%.*]], label [[EXIT_2:%.*]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[A]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ult i8 [[A]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: ret i1 [[RES_1]] ; CHECK: exit.2: ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[A]], 3 -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[A]], 2 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[C_3]], false ; CHECK-NEXT: ret i1 [[RES_2]] ; @@ -588,7 +563,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_B]]) ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw i8 [[A]], [[B]] ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw i8 [[ADD_1]], 2 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD_2]], 13 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[ADD_2]], 14 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: ret i1 [[RES_1]] @@ -616,7 +590,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw i8 [[A]], [[B]] ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw i8 [[ADD_1]], 2 ; CHECK-NEXT: [[ADD_3:%.*]] = add nuw i8 [[ADD_2]], [[A]] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD_3]], 18 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[ADD_3]], 19 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: ret i1 [[RES_1]] @@ -645,7 +618,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw i8 [[A]], 2 ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw i8 [[ADD_1]], [[B]] ; CHECK-NEXT: [[ADD_3:%.*]] = add nuw i8 [[ADD_2]], [[A]] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD_3]], 18 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[ADD_3]], 19 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: ret i1 [[RES_1]] @@ -674,7 +646,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw i8 [[A]], 2 ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw i8 [[ADD_1]], [[B]] ; CHECK-NEXT: [[ADD_3:%.*]] = add nuw i8 [[ADD_2]], 10 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD_3]], 23 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[ADD_3]], 24 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: ret i1 [[RES_1]] diff --git a/llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll b/llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll --- a/llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll +++ b/llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 ; RUN: opt -passes='require,constraint-elimination,require' -disable-verify -verify-analysis-invalidation=false -debug-pass-manager -disable-output %s 2>&1 | FileCheck %s ; Check that constraint-elimination properly invalidates anlyses. @@ -65,3 +66,5 @@ bb2: ret i1 false } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}} diff --git a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll --- a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll +++ b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll @@ -138,7 +138,6 @@ ; CHECK: else.2: ; CHECK-NEXT: ret i1 false ; CHECK: exit: -; CHECK-NEXT: [[T:%.*]] = icmp eq ptr null, null ; CHECK-NEXT: ret i1 true ; entry: @@ -167,7 +166,6 @@ ; CHECK-LABEL: @test_and_op_0_simplified( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C_1:%.*]] = icmp sgt i32 [[V:%.*]], 0 -; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i32 0, 0 ; CHECK-NEXT: [[AND:%.*]] = and i1 false, [[C_1]] ; CHECK-NEXT: ret i1 [[AND]] ; @@ -182,7 +180,6 @@ ; CHECK-LABEL: @test_and_op_1_simplified( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C_1:%.*]] = icmp sgt i32 [[V:%.*]], 0 -; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i32 0, 0 ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], false ; CHECK-NEXT: ret i1 [[AND]] ; diff --git a/llvm/test/Transforms/ConstraintElimination/and.ll b/llvm/test/Transforms/ConstraintElimination/and.ll --- a/llvm/test/Transforms/ConstraintElimination/and.ll +++ b/llvm/test/Transforms/ConstraintElimination/and.ll @@ -11,10 +11,7 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[AND]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true ; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[A:%.*]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_3]] @@ -72,10 +69,7 @@ ; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false ; CHECK-NEXT: br i1 [[AND]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true ; CHECK-NEXT: [[C_3:%.*]] = icmp ule i4 [[X]], [[A:%.*]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_3]] @@ -153,10 +147,9 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[EXIT_3:%.*]] ; CHECK: then: -; CHECK-NEXT: [[CMP_1:%.*]] = icmp ugt ptr [[PTR_2:%.*]], [[PTR_2]] ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[IDX:%.*]] to i16 ; CHECK-NEXT: [[GEP_IDX_EXT:%.*]] = getelementptr inbounds i8, ptr [[PTR_1:%.*]], i16 [[IDX_EXT]] -; CHECK-NEXT: [[CMP_2:%.*]] = icmp ult ptr [[PTR_2]], [[GEP_IDX_EXT]] +; CHECK-NEXT: [[CMP_2:%.*]] = icmp ult ptr [[PTR_2:%.*]], [[GEP_IDX_EXT]] ; CHECK-NEXT: [[AND:%.*]] = and i1 false, [[CMP_2]] ; CHECK-NEXT: br i1 [[AND]], label [[EXIT_1:%.*]], label [[EXIT_2:%.*]] ; CHECK: exit.1: @@ -201,14 +194,9 @@ ; CHECK-NEXT: [[AND_3:%.*]] = and i1 [[C_4]], [[AND_2]] ; CHECK-NEXT: br i1 [[AND_3]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i4 3, [[X]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], true -; CHECK-NEXT: [[T_5:%.*]] = icmp ule i4 3, [[A]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -289,14 +277,9 @@ ; CHECK-NEXT: [[AND_3:%.*]] = and i1 [[AND_1]], [[AND_2]] ; CHECK-NEXT: br i1 [[AND_3]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i4 3, [[X]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], true -; CHECK-NEXT: [[T_5:%.*]] = icmp ule i4 3, [[A]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -378,10 +361,7 @@ ; CHECK-NEXT: [[AND_3:%.*]] = and i1 [[AND_1]], [[AND_2]] ; CHECK-NEXT: br i1 [[AND_3]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], true ; CHECK-NEXT: [[C_4:%.*]] = icmp ule i4 3, [[X]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] @@ -465,13 +445,10 @@ ; CHECK-NEXT: br i1 [[AND_3]], label [[BB1:%.*]], label [[EXIT:%.*]] ; CHECK: bb1: ; CHECK-NEXT: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i4 [[X]], [[Y]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 [[T_1]], true ; CHECK-NEXT: [[T_3:%.*]] = icmp ule i4 [[Y]], [[Z]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[T_3]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i4 3, [[X]] ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], true -; CHECK-NEXT: [[T_5:%.*]] = icmp ule i4 3, [[A]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] diff --git a/llvm/test/Transforms/ConstraintElimination/assumes.ll b/llvm/test/Transforms/ConstraintElimination/assumes.ll --- a/llvm/test/Transforms/ConstraintElimination/assumes.ll +++ b/llvm/test/Transforms/ConstraintElimination/assumes.ll @@ -14,16 +14,12 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: else: -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2_1:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[ADD_2_1]], [[B]] @@ -62,16 +58,12 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: else: -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2_1:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[ADD_2_1]], [[B]] @@ -111,16 +103,12 @@ ; CHECK-NEXT: call void @may_unwind() ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: else: -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2_1:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[ADD_2_1]], [[B]] @@ -188,7 +176,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: exit: -; CHECK-NEXT: [[C_2:%.*]] = icmp eq i16 [[A]], 0 ; CHECK-NEXT: ret i1 true ; entry: @@ -263,8 +250,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i8 [[A:%.*]], 1 ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -290,8 +275,6 @@ ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -335,8 +318,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i8 [[A:%.*]], 1 ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -369,8 +350,6 @@ ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] ; CHECK-NEXT: call void @may_unwind() ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -403,8 +382,6 @@ ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) ; CHECK-NEXT: call void @may_unwind() -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -432,11 +409,9 @@ define i1 @assume_same_bb_after_condition(i8 %a, i8 %b, i1 %c) { ; CHECK-LABEL: @assume_same_bb_after_condition( ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i8 [[A:%.*]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B]] +; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_2]], [[B:%.*]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) @@ -508,7 +483,6 @@ ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: call void @may_unwind() ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[ADD_2:%.*]] = add nuw nsw i8 [[A]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[ADD_2]], [[B]] @@ -570,7 +544,6 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i8 [[A:%.*]], 1 ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ule i8 [[ADD_1]], [[B:%.*]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[ADD_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: call void @may_unwind() ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_1]]) diff --git a/llvm/test/Transforms/ConstraintElimination/cond-used-in-phi.ll b/llvm/test/Transforms/ConstraintElimination/cond-used-in-phi.ll --- a/llvm/test/Transforms/ConstraintElimination/cond-used-in-phi.ll +++ b/llvm/test/Transforms/ConstraintElimination/cond-used-in-phi.ll @@ -12,7 +12,6 @@ ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[C_PHI:%.*]] = phi i1 [ false, [[ENTRY]] ], [ true, [[LOOP]] ] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 8 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IV_NEXT]] = add i8 [[IV]], 1 ; CHECK-NEXT: [[EC:%.*]] = icmp ult i8 [[IV_NEXT]], 3 @@ -54,7 +53,6 @@ ; CHECK-NEXT: br label [[LOOP_2:%.*]] ; CHECK: loop.2: ; CHECK-NEXT: [[IV:%.*]] = phi i8 [ 0, [[LOOP_1_HEADER]] ], [ [[IV_NEXT:%.*]], [[LOOP_2]] ] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 8 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IV_NEXT]] = add i8 [[IV]], 1 ; CHECK-NEXT: [[EC:%.*]] = icmp ult i8 [[IV_NEXT]], 3 @@ -104,7 +102,6 @@ ; CHECK-NEXT: [[C_PHI:%.*]] = phi i1 [ false, [[ENTRY]] ], [ true, [[LOOP_LATCH]] ] ; CHECK-NEXT: br i1 [[C:%.*]], label [[LOOP_LATCH]], label [[LOOP_EXIT:%.*]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 8 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IV_NEXT]] = add i8 [[IV]], 1 ; CHECK-NEXT: [[EC:%.*]] = icmp ult i8 [[IV_NEXT]], 3 @@ -145,7 +142,6 @@ ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X:%.*]], 1 ; CHECK-NEXT: br i1 [[CMP1]], label [[IF:%.*]], label [[JOIN:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[X]], 0 ; CHECK-NEXT: br label [[JOIN]] ; CHECK: join: ; CHECK-NEXT: [[PHI:%.*]] = phi i1 [ true, [[IF]] ], [ false, [[ENTRY:%.*]] ] @@ -168,10 +164,9 @@ define i1 @test_if_then_2(i1 %c, i8 %x) { ; CHECK-LABEL: @test_if_then_2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[X:%.*]], 0 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[JOIN:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X]], 1 +; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X:%.*]], 1 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP1]]) ; CHECK-NEXT: br label [[JOIN]] ; CHECK: join: @@ -228,7 +223,6 @@ ; CHECK-NEXT: br i1 [[C_0:%.*]], label [[IF:%.*]], label [[JOIN:%.*]] ; CHECK: if: ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 [[X:%.*]], 1 -; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[X]], 1 ; CHECK-NEXT: br i1 [[CMP1]], label [[THEN_1:%.*]], label [[ELSE_1:%.*]] ; CHECK: then.1: ; CHECK-NEXT: br label [[JOIN]] diff --git a/llvm/test/Transforms/ConstraintElimination/constants-signed-predicates.ll b/llvm/test/Transforms/ConstraintElimination/constants-signed-predicates.ll --- a/llvm/test/Transforms/ConstraintElimination/constants-signed-predicates.ll +++ b/llvm/test/Transforms/ConstraintElimination/constants-signed-predicates.ll @@ -4,14 +4,9 @@ define i1 @test_slt() { ; CHECK-LABEL: @test_slt( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 10, 11 -; CHECK-NEXT: [[F_0:%.*]] = icmp slt i8 10, 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[F_1:%.*]] = icmp slt i8 10, 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp slt i8 10, -10 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], false -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 10, 11 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true ; CHECK-NEXT: ret i1 [[RES_4]] ; @@ -31,14 +26,9 @@ define i1 @test_sgt() { ; CHECK-LABEL: @test_sgt( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[T_0:%.*]] = icmp sgt i8 11, 10 -; CHECK-NEXT: [[F_0:%.*]] = icmp sgt i8 10, 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[F_1:%.*]] = icmp sgt i8 9, 10 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp sgt i8 -10, 10 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], false -; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i8 -1, -2 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true ; CHECK-NEXT: ret i1 [[RES_4]] ; @@ -62,7 +52,6 @@ ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i8, ptr [[BASE:%.*]], i8 1 ; CHECK-NEXT: [[T_0:%.*]] = icmp slt ptr [[BASE]], [[GEP_1]] ; CHECK-NEXT: [[GEP_0:%.*]] = getelementptr inbounds i8, ptr [[BASE]], i8 0 -; CHECK-NEXT: [[F_0:%.*]] = icmp slt ptr [[BASE]], [[GEP_0]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[T_0]], false ; CHECK-NEXT: [[C_1:%.*]] = icmp slt ptr [[GEP_1]], [[BASE]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] diff --git a/llvm/test/Transforms/ConstraintElimination/constants-unsigned-predicates.ll b/llvm/test/Transforms/ConstraintElimination/constants-unsigned-predicates.ll --- a/llvm/test/Transforms/ConstraintElimination/constants-unsigned-predicates.ll +++ b/llvm/test/Transforms/ConstraintElimination/constants-unsigned-predicates.ll @@ -4,12 +4,8 @@ define i1 @test_ult() { ; CHECK-LABEL: @test_ult( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[T_0:%.*]] = icmp ult i8 10, 11 -; CHECK-NEXT: [[F_0:%.*]] = icmp ult i8 10, 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 10, 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 10, -10 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], true ; CHECK-NEXT: ret i1 [[RES_3]] ; @@ -29,11 +25,8 @@ ; CHECK-LABEL: @test_ult_gep_1( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i8, ptr [[BASE:%.*]], i8 1 -; CHECK-NEXT: [[T_0:%.*]] = icmp ult ptr [[BASE]], [[GEP_1]] ; CHECK-NEXT: [[GEP_0:%.*]] = getelementptr inbounds i8, ptr [[BASE]], i8 0 -; CHECK-NEXT: [[F_0:%.*]] = icmp ult ptr [[BASE]], [[GEP_0]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[F_1:%.*]] = icmp ult ptr [[GEP_1]], [[BASE]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false ; CHECK-NEXT: ret i1 [[RES_2]] ; @@ -51,7 +44,6 @@ define i1 @test_ult_gep_2(ptr %base) { ; CHECK-LABEL: @test_ult_gep_2( ; CHECK-NEXT: [[GEP_SUB_1:%.*]] = getelementptr inbounds i8, ptr [[BASE:%.*]], i8 -1 -; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[BASE]], [[GEP_SUB_1]] ; CHECK-NEXT: ret i1 false ; %gep.sub.1 = getelementptr inbounds i8, ptr %base, i8 -1 @@ -73,10 +65,7 @@ define i1 @test_eq() { ; CHECK-LABEL: @test_eq( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[F_0:%.*]] = icmp eq i8 10, 11 -; CHECK-NEXT: [[T_0:%.*]] = icmp eq i8 10, 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[F_1:%.*]] = icmp eq i8 10, 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false ; CHECK-NEXT: ret i1 [[RES_2]] ; @@ -92,10 +81,7 @@ define i1 @test_ne() { ; CHECK-LABEL: @test_ne( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[T_0:%.*]] = icmp ne i8 10, 11 -; CHECK-NEXT: [[F_0:%.*]] = icmp ne i8 10, 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 10, 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true ; CHECK-NEXT: ret i1 [[RES_2]] ; diff --git a/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll b/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll --- a/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll +++ b/llvm/test/Transforms/ConstraintElimination/decompose-with-temporary-indices.ll @@ -13,8 +13,6 @@ ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw nsw i8 [[START]], 1 ; CHECK-NEXT: br i1 [[CMP_PRE]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[T_0:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_N]] -; CHECK-NEXT: [[F_0:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] @@ -22,8 +20,6 @@ ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: if.end: -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[START_ADD_IDX]], [[START_ADD_N]] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[START_ADD_IDX]], [[START_ADD_N]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 false, true ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_ADD_N]] ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_3]] diff --git a/llvm/test/Transforms/ConstraintElimination/dom.ll b/llvm/test/Transforms/ConstraintElimination/dom.ll --- a/llvm/test/Transforms/ConstraintElimination/dom.ll +++ b/llvm/test/Transforms/ConstraintElimination/dom.ll @@ -12,7 +12,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br label [[BB2]] ; CHECK: bb2: @@ -39,7 +38,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: else: @@ -73,7 +71,6 @@ ; CHECK: then: ; CHECK-NEXT: br label [[EXIT:%.*]] ; CHECK: else: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: @@ -106,7 +103,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br label [[BB1]] ; @@ -136,7 +132,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: ret i1 true ; entry: @@ -163,7 +158,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2]] ; CHECK: bb1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: ret i1 true ; CHECK: bb2: ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[X]], 10 @@ -194,9 +188,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP:%.*]], label [[BB2]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -204,7 +196,6 @@ ; CHECK-NEXT: call void @use(i1 [[C_3]]) ; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[LOOP]] ; CHECK: exit: -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: ret i1 true ; CHECK: bb2: ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[X]], 10 @@ -247,9 +238,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB2]], label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -257,7 +246,6 @@ ; CHECK-NEXT: call void @use(i1 [[C_3]]) ; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[LOOP]] ; CHECK: exit: -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: ret i1 false ; CHECK: bb2: ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[X]], 10 @@ -305,16 +293,12 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[AND]], label [[LOOP:%.*]], label [[EXIT_1:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[X]], 10 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 9 ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i8 [[Y]], 99 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], false ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[Y]], 100 ; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_3]] @@ -402,7 +386,6 @@ ; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[Y]], 10 ; CHECK-NEXT: ret i1 true ; entry: @@ -458,16 +441,12 @@ ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[OR]], label [[EXIT_1:%.*]], label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 10 -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X]], 11 ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_2]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[Y]], 99 ; CHECK-NEXT: [[R_4:%.*]] = xor i1 [[R_3]], true -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[Y]], 99 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], false ; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[Y]], 98 ; CHECK-NEXT: [[R_6:%.*]] = xor i1 [[R_5]], [[C_3]] @@ -550,7 +529,6 @@ ; CHECK-NEXT: call void @use(i1 [[R_7]]) ; CHECK-NEXT: br i1 true, label [[EXIT]], label [[LOOP]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[Y]], 100 ; CHECK-NEXT: ret i1 true ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/empty-constraint.ll b/llvm/test/Transforms/ConstraintElimination/empty-constraint.ll --- a/llvm/test/Transforms/ConstraintElimination/empty-constraint.ll +++ b/llvm/test/Transforms/ConstraintElimination/empty-constraint.ll @@ -6,12 +6,10 @@ define i1 @test_1_always_false(i32 %A, i32 %B) { ; CHECK-LABEL: @test_1_always_false( -; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i32 [[A:%.*]], [[A]] ; CHECK-NEXT: br i1 false, label [[IF_END_I16:%.*]], label [[IF_THEN_I10:%.*]] ; CHECK: if.then.i10: ; CHECK-NEXT: ret i1 false ; CHECK: if.end.i16: -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[A]], [[A]] ; CHECK-NEXT: ret i1 false ; %c.1 = icmp ugt i32 %A, %A @@ -32,7 +30,6 @@ ; CHECK: if.then.i10: ; CHECK-NEXT: ret i1 false ; CHECK: if.end.i16: -; CHECK-NEXT: [[C_2:%.*]] = icmp uge i32 [[A]], [[A]] ; CHECK-NEXT: ret i1 true ; %c.1 = icmp uge i32 %A, %B diff --git a/llvm/test/Transforms/ConstraintElimination/eq.ll b/llvm/test/Transforms/ConstraintElimination/eq.ll --- a/llvm/test/Transforms/ConstraintElimination/eq.ll +++ b/llvm/test/Transforms/ConstraintElimination/eq.ll @@ -9,16 +9,10 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], [[B:%.*]] ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[A]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp eq i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp eq i8 [[B]], [[A]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], true -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[B]], [[A]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp ult i8 [[B]], [[A]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[B]], 99 ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[C_1]] @@ -95,14 +89,9 @@ ; CHECK-NEXT: [[PRE_3:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: br i1 [[PRE_3]], label [[THEN_THEN:%.*]], label [[THEN_ELSE:%.*]] ; CHECK: then.then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[A]], 100 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[A]], 100 ; CHECK-NEXT: [[XOR_2:%.*]] = xor i1 [[XOR_1]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[B]], 100 ; CHECK-NEXT: [[XOR_3:%.*]] = xor i1 [[XOR_2]], false -; CHECK-NEXT: [[F_3_1:%.*]] = icmp ugt i8 [[A]], 99 ; CHECK-NEXT: [[XOR_4:%.*]] = xor i1 [[XOR_3]], false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[A]], 99 ; CHECK-NEXT: [[XOR_5:%.*]] = xor i1 [[XOR_4]], [[C_1]] @@ -110,18 +99,11 @@ ; CHECK-NEXT: [[XOR_6:%.*]] = xor i1 [[XOR_5]], [[C_1]] ; CHECK-NEXT: ret i1 [[XOR_6]] ; CHECK: then.else: -; CHECK-NEXT: [[F_4:%.*]] = icmp ult i8 [[A]], 100 -; CHECK-NEXT: [[F_5:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: [[XOR_7:%.*]] = xor i1 false, false -; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 [[A]], 100 ; CHECK-NEXT: [[XOR_8:%.*]] = xor i1 [[XOR_7]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp uge i8 [[B]], 100 ; CHECK-NEXT: [[XOR_9:%.*]] = xor i1 [[XOR_8]], true -; CHECK-NEXT: [[T_5:%.*]] = icmp ugt i8 [[A]], 99 ; CHECK-NEXT: [[XOR_10:%.*]] = xor i1 [[XOR_9]], true -; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[A]], 99 ; CHECK-NEXT: [[XOR_11:%.*]] = xor i1 [[XOR_10]], false -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i8 [[A]], 98 ; CHECK-NEXT: [[XOR_12:%.*]] = xor i1 [[XOR_11]], true ; CHECK-NEXT: ret i1 [[XOR_12]] ; CHECK: else: @@ -197,14 +179,9 @@ ; CHECK-NEXT: [[PRE_3:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: br i1 [[PRE_3]], label [[THEN_THEN:%.*]], label [[THEN_ELSE:%.*]] ; CHECK: then.then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[A]], 100 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[A]], 100 ; CHECK-NEXT: [[XOR_2:%.*]] = xor i1 [[XOR_1]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[B]], 100 ; CHECK-NEXT: [[XOR_3:%.*]] = xor i1 [[XOR_2]], false -; CHECK-NEXT: [[F_3_1:%.*]] = icmp ugt i8 [[A]], 99 ; CHECK-NEXT: [[XOR_4:%.*]] = xor i1 [[XOR_3]], false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[A]], 99 ; CHECK-NEXT: [[XOR_5:%.*]] = xor i1 [[XOR_4]], [[C_1]] @@ -212,18 +189,11 @@ ; CHECK-NEXT: [[XOR_6:%.*]] = xor i1 [[XOR_5]], [[C_1]] ; CHECK-NEXT: ret i1 [[XOR_6]] ; CHECK: then.else: -; CHECK-NEXT: [[F_4:%.*]] = icmp ult i8 [[A]], 100 -; CHECK-NEXT: [[F_5:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: [[XOR_7:%.*]] = xor i1 false, false -; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 [[A]], 100 ; CHECK-NEXT: [[XOR_8:%.*]] = xor i1 [[XOR_7]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp uge i8 [[B]], 100 ; CHECK-NEXT: [[XOR_9:%.*]] = xor i1 [[XOR_8]], true -; CHECK-NEXT: [[T_5:%.*]] = icmp ugt i8 [[A]], 99 ; CHECK-NEXT: [[XOR_10:%.*]] = xor i1 [[XOR_9]], true -; CHECK-NEXT: [[C_3:%.*]] = icmp ult i8 [[A]], 99 ; CHECK-NEXT: [[XOR_11:%.*]] = xor i1 [[XOR_10]], false -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i8 [[A]], 98 ; CHECK-NEXT: [[XOR_12:%.*]] = xor i1 [[XOR_11]], true ; CHECK-NEXT: ret i1 [[XOR_12]] ; CHECK: else: @@ -298,14 +268,9 @@ ; CHECK-NEXT: [[PRE_AND:%.*]] = and i1 [[PRE_1]], [[PRE_2]] ; CHECK-NEXT: br i1 [[PRE_AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[A]], 100 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[B]], 100 ; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[A]], 100 ; CHECK-NEXT: [[XOR_2:%.*]] = xor i1 [[XOR_1]], false -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[B]], 100 ; CHECK-NEXT: [[XOR_3:%.*]] = xor i1 [[XOR_2]], false -; CHECK-NEXT: [[F_3_1:%.*]] = icmp ugt i8 [[A]], 99 ; CHECK-NEXT: [[XOR_4:%.*]] = xor i1 [[XOR_3]], false ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[A]], 99 ; CHECK-NEXT: [[XOR_5:%.*]] = xor i1 [[XOR_4]], [[C_1]] @@ -384,7 +349,6 @@ ; CHECK-NEXT: [[TMP1:%.*]] = add nuw i64 [[B:%.*]], 1 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i64 [[TMP1]], [[A:%.*]] ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP2]]) -; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i64 [[A]], [[B]] ; CHECK-NEXT: ret i1 false ; %1 = add nuw i64 %b, 1 @@ -399,7 +363,6 @@ ; CHECK-NEXT: [[TMP1:%.*]] = add nuw i64 [[A:%.*]], 1 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], [[B:%.*]] ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP2]]) -; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i64 [[A]], [[B]] ; CHECK-NEXT: ret i1 false ; %1 = add nuw i64 %a, 1 @@ -435,10 +398,8 @@ ; CHECK-NEXT: [[BC_EQ:%.*]] = icmp eq i64 [[B]], [[C:%.*]] ; CHECK-NEXT: br i1 [[BC_EQ]], label [[BC_EQUAL:%.*]], label [[NOT_EQ]] ; CHECK: bc_equal: -; CHECK-NEXT: [[AC_EQ:%.*]] = icmp eq i64 [[A]], [[C]] ; CHECK-NEXT: [[A_PLUS_1:%.*]] = add nuw i64 [[A]], 1 ; CHECK-NEXT: [[C_PLUS_1:%.*]] = add nuw i64 [[C]], 1 -; CHECK-NEXT: [[AC_PLUS_1_EQ:%.*]] = icmp eq i64 [[A_PLUS_1]], [[C_PLUS_1]] ; CHECK-NEXT: [[RESULT:%.*]] = and i1 true, true ; CHECK-NEXT: ret i1 [[RESULT]] ; CHECK: not_eq: diff --git a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll @@ -8,7 +8,6 @@ ; CHECK-NEXT: [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0 ; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1 -; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[GEP_1]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0 @@ -23,7 +22,6 @@ ; CHECK-NEXT: [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0 ; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 3 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1 -; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[GEP_1]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0 @@ -38,7 +36,6 @@ ; CHECK-NEXT: [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0 ; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 2 -; CHECK-NEXT: [[C:%.*]] = icmp ult ptr [[GEP_1]], [[UPPER]] ; CHECK-NEXT: ret i1 false ; %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0 @@ -202,7 +199,6 @@ ; CHECK-NEXT: [[DST_0:%.*]] = getelementptr inbounds ptr, ptr [[DST:%.*]], i64 0 ; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds ptr, ptr [[DST]], i64 2 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds [2 x i32], ptr [[DST_0]], i64 1, i64 1 -; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[GEP_1]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %dst.0 = getelementptr inbounds ptr, ptr %dst, i64 0 diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-add.ll @@ -294,7 +294,6 @@ ; CHECK: ptr.check: ; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i32 [[STEP_ADD_1_EXT]] ; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult ptr [[SRC_STEP]], [[LOWER]] -; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge ptr [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 [[CMP_STEP_START]], false ; CHECK-NEXT: br i1 [[OR_CHECK]], label [[TRAP_BB]], label [[EXIT]] ; CHECK: exit: diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-different-types.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-different-types.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-different-types.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-different-types.ll @@ -11,7 +11,6 @@ ; CHECK-NEXT: [[ADD_I16_4:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 4 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I16_4]], [[UPPER]] ; CHECK-NEXT: [[ADD_I16_2:%.*]] = getelementptr inbounds i16, ptr [[A]], i64 2 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I16_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -35,7 +34,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_0]]) ; CHECK-NEXT: [[ADD_I8_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 1 ; CHECK-NEXT: [[ADD_I16_1:%.*]] = getelementptr inbounds i16, ptr [[ADD_I8_1]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I16_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I16_2:%.*]] = getelementptr inbounds i16, ptr [[ADD_I8_1]], i64 2 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I16_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] @@ -65,7 +63,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX:%.*]] = getelementptr inbounds i32, ptr [[A]], i8 [[IDX]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX:%.*]] = getelementptr inbounds i8, ptr [[A]], i8 [[IDX]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -95,7 +92,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i8 [[IDX_1]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i8 [[IDX_1]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: [[ADD_I16_IDX_1:%.*]] = getelementptr inbounds i16, ptr [[A]], i8 [[IDX_1]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ult ptr [[ADD_I16_IDX_1]], [[UPPER]] @@ -167,7 +163,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i16 [[IDX_1_EXT]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i16 [[IDX_1_EXT]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: [[ADD_I16_IDX_1:%.*]] = getelementptr inbounds i16, ptr [[A]], i16 [[IDX_1_EXT]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ult ptr [[ADD_I16_IDX_1]], [[UPPER]] @@ -207,7 +202,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i16 [[IDX_1_EXT]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i16 [[IDX_1_EXT]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -269,7 +263,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i16 [[IDX_1_EXT]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[ADD_I8_IDX_2]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i16 [[IDX_1_EXT]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[ADD_I8_IDX_2]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -334,7 +327,6 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i16 [[IDX_1_EXT]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i16 [[IDX_1_EXT]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -370,10 +362,8 @@ ; CHECK-NEXT: [[ADD_I32_IDX_1:%.*]] = getelementptr inbounds i32, ptr [[A]], i8 [[IDX_1]] ; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I32_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[ADD_I8_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i8 [[IDX_1]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ult ptr [[ADD_I8_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[T_1]], true ; CHECK-NEXT: [[ADD_I16_IDX_1:%.*]] = getelementptr inbounds i16, ptr [[A]], i8 [[IDX_1]] -; CHECK-NEXT: [[T_3:%.*]] = icmp ult ptr [[ADD_I16_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true ; CHECK-NEXT: [[ADD_I64_IDX_1:%.*]] = getelementptr inbounds i64, ptr [[A]], i8 [[IDX_1]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I64_IDX_1]], [[UPPER]] @@ -413,7 +403,6 @@ ; CHECK-NEXT: [[ADD_I16_4:%.*]] = getelementptr inbounds <4 x i16>, ptr [[A]], i64 4 ; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[ADD_I16_4]], [[UPPER]] ; CHECK-NEXT: [[ADD_I16_2:%.*]] = getelementptr inbounds <4 x i16>, ptr [[A]], i64 2 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[ADD_I16_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_1]], true ; CHECK-NEXT: ret i1 [[RES_1]] ; diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-signed-predicates.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-signed-predicates.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-signed-predicates.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic-signed-predicates.ll @@ -11,7 +11,6 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[PRE_DST_LOWER]], [[PRE_DST_UPPER]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[CMP_DST_LOWER:%.*]] = icmp sge ptr [[DST]], [[LOWER]] ; CHECK-NEXT: [[CMP_DST_UPPER:%.*]] = icmp slt ptr [[DST]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_DST_UPPER]] ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 @@ -20,7 +19,6 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[CMP_DST_ADD_3_LOWER]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[CMP_DST_ADD_3_UPPER]] ; CHECK-NEXT: [[CMP_DST_ADD_4_LOWER:%.*]] = icmp sge ptr [[DST_ADD_4]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_ADD_4_UPPER:%.*]] = icmp slt ptr [[DST_ADD_4]], [[UPPER]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[CMP_DST_ADD_4_LOWER]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[DST_ADD_5:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5 @@ -70,7 +68,6 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[PRE_DST_LOWER]], [[PRE_DST_UPPER]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[CMP_DST_LOWER:%.*]] = icmp sge ptr [[DST]], [[LOWER]] ; CHECK-NEXT: [[CMP_DST_UPPER:%.*]] = icmp slt ptr [[DST]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_DST_UPPER]] ; CHECK-NEXT: [[DST_SUB_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 -3 @@ -79,7 +76,6 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[CMP_DST_SUB_3_LOWER]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[CMP_DST_SUB_3_UPPER]] ; CHECK-NEXT: [[CMP_DST_SUB_4_LOWER:%.*]] = icmp sge ptr [[DST_SUB_4]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_SUB_4_UPPER:%.*]] = icmp slt ptr [[DST_SUB_4]], [[UPPER]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[CMP_DST_SUB_4_LOWER]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[DST_SUB_5:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 -5 @@ -280,7 +276,6 @@ ; CHECK: trap.bb: ; CHECK-NEXT: ret i4 2 ; CHECK: step.check: -; CHECK-NEXT: [[STEP_SGE_0:%.*]] = icmp sge i16 [[STEP]], 0 ; CHECK-NEXT: [[STEP_SLT_N:%.*]] = icmp slt i16 [[STEP]], [[N]] ; CHECK-NEXT: [[AND_2:%.*]] = and i1 true, [[STEP_SLT_N]] ; CHECK-NEXT: br i1 [[AND_2]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] diff --git a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll @@ -11,20 +11,13 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[PRE_DST_LOWER]], [[PRE_DST_UPPER]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[CMP_DST_LOWER:%.*]] = icmp uge ptr [[DST]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_UPPER:%.*]] = icmp ult ptr [[DST]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 -; CHECK-NEXT: [[CMP_DST_ADD_3_LOWER:%.*]] = icmp uge ptr [[DST_ADD_3]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_ADD_3_UPPER:%.*]] = icmp ult ptr [[DST_ADD_3]], [[UPPER]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], true -; CHECK-NEXT: [[CMP_DST_ADD_4_LOWER:%.*]] = icmp uge ptr [[DST_ADD_4]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_ADD_4_UPPER:%.*]] = icmp ult ptr [[DST_ADD_4]], [[UPPER]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[DST_ADD_5:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5 -; CHECK-NEXT: [[CMP_DST_ADD_5_LOWER:%.*]] = icmp uge ptr [[DST_ADD_5]], [[LOWER]] ; CHECK-NEXT: [[CMP_DST_ADD_5_UPPER:%.*]] = icmp ult ptr [[DST_ADD_5]], [[UPPER]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], true ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[CMP_DST_ADD_5_UPPER]] @@ -70,7 +63,6 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[PRE_DST_LOWER]], [[PRE_DST_UPPER]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[CMP_DST_LOWER:%.*]] = icmp uge ptr [[DST]], [[LOWER]] ; CHECK-NEXT: [[CMP_DST_UPPER:%.*]] = icmp ult ptr [[DST]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_DST_UPPER]] ; CHECK-NEXT: [[DST_SUB_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 -3 @@ -79,12 +71,10 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[CMP_DST_SUB_3_LOWER]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[CMP_DST_SUB_3_UPPER]] ; CHECK-NEXT: [[CMP_DST_SUB_4_LOWER:%.*]] = icmp uge ptr [[DST_SUB_4]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_SUB_4_UPPER:%.*]] = icmp ult ptr [[DST_SUB_4]], [[UPPER]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[CMP_DST_SUB_4_LOWER]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[DST_SUB_5:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 -5 ; CHECK-NEXT: [[CMP_DST_SUB_5_LOWER:%.*]] = icmp uge ptr [[DST_SUB_5]], [[LOWER]] -; CHECK-NEXT: [[CMP_DST_SUB_5_UPPER:%.*]] = icmp ult ptr [[DST_SUB_5]], [[UPPER]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[CMP_DST_SUB_5_LOWER]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], true ; CHECK-NEXT: ret i1 [[RES_7]] @@ -173,8 +163,6 @@ ; CHECK-NEXT: br i1 [[STEP_ULT_N]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: ; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 1 -; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult ptr [[SRC_STEP]], [[LOWER]] -; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge ptr [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, false ; CHECK-NEXT: br i1 [[OR_CHECK]], label [[TRAP_BB]], label [[EXIT]] ; CHECK: exit: @@ -280,14 +268,11 @@ ; CHECK: trap.bb: ; CHECK-NEXT: ret i4 2 ; CHECK: step.check: -; CHECK-NEXT: [[STEP_UGE_0:%.*]] = icmp uge i16 [[STEP]], 0 ; CHECK-NEXT: [[STEP_ULT_N:%.*]] = icmp ult i16 [[STEP]], [[N]] ; CHECK-NEXT: [[AND_2:%.*]] = and i1 true, [[STEP_ULT_N]] ; CHECK-NEXT: br i1 [[AND_2]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: ; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 1 -; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult ptr [[SRC_STEP]], [[LOWER]] -; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge ptr [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, false ; CHECK-NEXT: br i1 [[OR_CHECK]], label [[TRAP_BB]], label [[EXIT]] ; CHECK: exit: @@ -346,7 +331,6 @@ ; CHECK-NEXT: br i1 [[AND_2]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: ; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 1 -; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult ptr [[SRC_STEP]], [[LOWER]] ; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge ptr [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, [[CMP_STEP_END]] ; CHECK-NEXT: br i1 [[OR_CHECK]], label [[TRAP_BB]], label [[EXIT]] @@ -403,8 +387,6 @@ ; CHECK-NEXT: br i1 [[AND_STEP]], label [[PTR_CHECK:%.*]], label [[EXIT:%.*]] ; CHECK: ptr.check: ; CHECK-NEXT: [[SRC_STEP:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i16 [[STEP]] -; CHECK-NEXT: [[CMP_STEP_START:%.*]] = icmp ult ptr [[SRC_STEP]], [[LOWER]] -; CHECK-NEXT: [[CMP_STEP_END:%.*]] = icmp uge ptr [[SRC_STEP]], [[UPPER]] ; CHECK-NEXT: [[OR_CHECK:%.*]] = or i1 false, false ; CHECK-NEXT: br i1 [[OR_CHECK]], label [[TRAP_BB]], label [[EXIT]] ; CHECK: exit: diff --git a/llvm/test/Transforms/ConstraintElimination/gep-chains.ll b/llvm/test/Transforms/ConstraintElimination/gep-chains.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-chains.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-chains.ll @@ -9,12 +9,9 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 ; CHECK-NEXT: [[DST_ADD_1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1 -; CHECK-NEXT: [[CMP_ADD_1:%.*]] = icmp uge ptr [[DST_ADD_1]], [[LOWER]] ; CHECK-NEXT: [[DST_ADD_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_1]], i64 1 -; CHECK-NEXT: [[CMP_ADD_3:%.*]] = icmp uge ptr [[DST_ADD_3]], [[LOWER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_ADD_4:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 3 -; CHECK-NEXT: [[CMP_ADD_4:%.*]] = icmp uge ptr [[DST_ADD_4]], [[LOWER]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true ; CHECK-NEXT: ret i1 [[RES_2]] ; @@ -67,9 +64,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 ; CHECK-NEXT: [[DST_ADD_1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1 -; CHECK-NEXT: [[CMP_ADD_1:%.*]] = icmp uge ptr [[DST_ADD_1]], [[LOWER]] ; CHECK-NEXT: [[DST_ADD_2:%.*]] = getelementptr i8, ptr [[DST_ADD_1]], i64 1 -; CHECK-NEXT: [[CMP_ADD_3:%.*]] = icmp uge ptr [[DST_ADD_3]], [[LOWER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_ADD_4:%.*]] = getelementptr i8, ptr [[DST_ADD_3]], i64 3 ; CHECK-NEXT: [[CMP_ADD_4:%.*]] = icmp uge ptr [[DST_ADD_4]], [[LOWER]] @@ -155,9 +150,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1 ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_1]], i64 2 -; CHECK-NEXT: [[CMP_ADD_3:%.*]] = icmp ult ptr [[DST_ADD_3]], [[UPPER]] ; CHECK-NEXT: [[DST_ADD_4:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_1]], i64 3 -; CHECK-NEXT: [[CMP_ADD_4:%.*]] = icmp ult ptr [[DST_ADD_4]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_ADD_5:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_1]], i64 4 ; CHECK-NEXT: [[CMP_ADD_5:%.*]] = icmp ult ptr [[DST_ADD_5]], [[UPPER]] @@ -188,7 +181,6 @@ ; CHECK-NEXT: [[PRE:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 1 -; CHECK-NEXT: [[CMP_ADD_1:%.*]] = icmp ule ptr [[DST_ADD_1]], [[UPPER]] ; CHECK-NEXT: [[DST_ADD_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 2 ; CHECK-NEXT: [[CMP_ADD_2:%.*]] = icmp ule ptr [[DST_ADD_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_ADD_2]] @@ -217,7 +209,6 @@ ; CHECK-NEXT: [[PRE:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 1 -; CHECK-NEXT: [[CMP_ADD_1:%.*]] = icmp ule ptr [[DST_ADD_1]], [[UPPER]] ; CHECK-NEXT: [[DST_ADD_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 2 ; CHECK-NEXT: [[CMP_ADD_2:%.*]] = icmp ule ptr [[DST_ADD_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_ADD_2]] @@ -251,9 +242,7 @@ ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[IDX]] to i16 ; CHECK-NEXT: [[DST_ADD_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i16 [[IDX_EXT]] ; CHECK-NEXT: [[DST_ADD_IDX_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 1 -; CHECK-NEXT: [[CMP_IDX_1:%.*]] = icmp ult ptr [[DST_ADD_IDX_1]], [[UPPER]] ; CHECK-NEXT: [[DST_ADD_IDX_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 2 -; CHECK-NEXT: [[CMP_IDX_2:%.*]] = icmp ult ptr [[DST_ADD_IDX_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_ADD_IDX_3:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 3 ; CHECK-NEXT: [[CMP_IDX_3:%.*]] = icmp ult ptr [[DST_ADD_IDX_3]], [[UPPER]] diff --git a/llvm/test/Transforms/ConstraintElimination/gep-constexpr.ll b/llvm/test/Transforms/ConstraintElimination/gep-constexpr.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-constexpr.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-constexpr.ll @@ -12,7 +12,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I]] to i64 ; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i16, ptr @arr1, i64 [[IDXPROM]] -; CHECK-NEXT: [[C_1:%.*]] = icmp ult ptr [[UPPER]], getelementptr inbounds ([3 x i16], ptr @arr1, i64 1, i64 0) ; CHECK-NEXT: ret i1 true ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/gep-sub.ll b/llvm/test/Transforms/ConstraintElimination/gep-sub.ll --- a/llvm/test/Transforms/ConstraintElimination/gep-sub.ll +++ b/llvm/test/Transforms/ConstraintElimination/gep-sub.ll @@ -9,9 +9,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 ; CHECK-NEXT: [[DST_SUB_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 -1 -; CHECK-NEXT: [[CMP_SUB_1:%.*]] = icmp uge ptr [[DST_SUB_1]], [[LOWER]] ; CHECK-NEXT: [[DST_SUB_3:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 -3 -; CHECK-NEXT: [[CMP_SUB_3:%.*]] = icmp uge ptr [[DST_SUB_3]], [[LOWER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_SUB_4:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 -4 ; CHECK-NEXT: [[CMP_SUB_4:%.*]] = icmp uge ptr [[DST_SUB_4]], [[LOWER]] @@ -126,9 +124,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 ; CHECK-NEXT: [[DST_SUB_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 -1 -; CHECK-NEXT: [[CMP_SUB_1:%.*]] = icmp ult ptr [[DST_SUB_1]], [[UPPER]] ; CHECK-NEXT: [[DST_SUB_3:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_3]], i64 -3 -; CHECK-NEXT: [[CMP_SUB_3:%.*]] = icmp ult ptr [[DST_SUB_3]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RES_1]] ; @@ -153,7 +149,6 @@ ; CHECK-NEXT: [[PRE:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_SUB_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 -1 -; CHECK-NEXT: [[CMP_SUB_1:%.*]] = icmp ult ptr [[DST_SUB_1]], [[UPPER]] ; CHECK-NEXT: [[DST_SUB_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 -2 ; CHECK-NEXT: [[CMP_SUB_2:%.*]] = icmp ult ptr [[DST_SUB_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[CMP_SUB_2]] @@ -192,9 +187,7 @@ ; CHECK-NEXT: [[PRE:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_SUB_1:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 -1 -; CHECK-NEXT: [[CMP_SUB_1:%.*]] = icmp ult ptr [[DST_SUB_1]], [[UPPER]] ; CHECK-NEXT: [[DST_SUB_2:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 -2 -; CHECK-NEXT: [[CMP_SUB_2:%.*]] = icmp ult ptr [[DST_SUB_2]], [[UPPER]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[DST_SUB_3:%.*]] = getelementptr inbounds i8, ptr [[DST_ADD_IDX]], i64 -3 ; CHECK-NEXT: [[CMP_SUB_3:%.*]] = icmp ult ptr [[DST_SUB_3]], [[UPPER]] @@ -231,7 +224,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_IDX_ULT_LEN]]) ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[IDX]] to i16 ; CHECK-NEXT: [[DST_ADD_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i16 [[IDX_EXT]] -; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %not.zero = icmp ne i8 %len, 0 @@ -355,7 +347,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_IDX_ULT_LEN]]) ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[IDX]] to i16 ; CHECK-NEXT: [[DST_ADD_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i16 [[IDX_EXT]] -; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %sge.2 = icmp sge i8 %len, 2 @@ -386,7 +377,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_IDX_ULT_LEN]]) ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i8 [[IDX]] to i16 ; CHECK-NEXT: [[DST_ADD_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i16 [[IDX_EXT]] -; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult ptr [[DST_ADD_IDX]], [[UPPER]] ; CHECK-NEXT: ret i1 true ; %uge.2 = icmp uge i8 %len, 2 @@ -526,7 +516,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[DST_ADD_3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3 ; CHECK-NEXT: [[DST_SUB_1:%.*]] = getelementptr inbounds i16, ptr [[DST_ADD_3]], i64 -1 -; CHECK-NEXT: [[CMP_SUB_1:%.*]] = icmp ule ptr [[DST_SUB_1]], [[LOWER]] ; CHECK-NEXT: [[DST_SUB_2:%.*]] = getelementptr inbounds i16, ptr [[DST_ADD_3]], i64 -2 ; CHECK-NEXT: [[CMP_SUB_2:%.*]] = icmp ule ptr [[DST_SUB_2]], [[DST]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[CMP_SUB_2]] diff --git a/llvm/test/Transforms/ConstraintElimination/geps-i32-pointer-indexes.ll b/llvm/test/Transforms/ConstraintElimination/geps-i32-pointer-indexes.ll --- a/llvm/test/Transforms/ConstraintElimination/geps-i32-pointer-indexes.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-i32-pointer-indexes.ll @@ -10,7 +10,6 @@ ; CHECK-NEXT: [[POS:%.*]] = icmp sge i64 [[OFF:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[POS]]) ; CHECK-NEXT: [[GEP_OFF:%.*]] = getelementptr inbounds i8, ptr [[DST:%.*]], i64 [[OFF]] -; CHECK-NEXT: [[CMP:%.*]] = icmp ule ptr [[DST]], [[GEP_OFF]] ; CHECK-NEXT: ret i1 true ; %pos = icmp sge i64 %off, 0 diff --git a/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-arrays.ll b/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-arrays.ll --- a/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-arrays.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-arrays.ll @@ -9,7 +9,6 @@ ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], ptr [[START]], i64 5, i64 0 -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; CHECK: if.end: @@ -67,7 +66,6 @@ ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; CHECK: if.then: ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [10 x i8], ptr [[START]], i64 5, i64 0 -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; CHECK: if.end: diff --git a/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-structs.ll b/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-structs.ll --- a/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-structs.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-pointers-to-structs.ll @@ -14,7 +14,6 @@ ; CHECK: if.then: ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], ptr [[START]], i64 5, i32 0 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -48,7 +47,6 @@ ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], ptr [[START]], i64 [[IDX_EXT]], i32 0 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -85,7 +83,6 @@ ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], ptr [[START]], i64 [[IDX_EXT]], i32 1 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -121,7 +118,6 @@ ; CHECK: if.then: ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], ptr [[START]], i64 [[IDX_EXT]], i32 2 -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -184,7 +180,6 @@ ; CHECK: if.then: ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_1]], ptr [[START]], i64 5, i32 1 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -305,7 +300,6 @@ ; CHECK: if.then: ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], ptr [[START]], i64 6, i32 0 ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true @@ -339,7 +333,6 @@ ; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64 ; CHECK-NEXT: [[START_0:%.*]] = getelementptr inbounds [[STRUCT_2]], ptr [[START]], i64 6, i32 1, i64 [[IDX_EXT]] ; CHECK-NEXT: [[START_0_CAST:%.*]] = bitcast ptr [[START_0]] to ptr -; CHECK-NEXT: [[C_0:%.*]] = icmp ult ptr [[START_0_CAST]], [[HIGH]] ; CHECK-NEXT: ret i1 true ; CHECK: if.end: ; CHECK-NEXT: ret i1 true diff --git a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll --- a/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-ptrvector.ll @@ -16,7 +16,6 @@ define <2 x i1> @test.vectorgep.ult.true(<2 x ptr> %vec) { ; CHECK-LABEL: @test.vectorgep.ult.true( ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <2 x ptr> [[VEC:%.*]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult <2 x ptr> [[VEC]], [[GEP_1]] ; CHECK-NEXT: ret <2 x i1> ; %gep.1 = getelementptr inbounds i32, <2 x ptr> %vec, i64 1 @@ -27,7 +26,6 @@ define <2 x i1> @test.vectorgep.ult.false(<2 x ptr> %vec) { ; CHECK-LABEL: @test.vectorgep.ult.false( ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, <2 x ptr> [[VEC:%.*]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult <2 x ptr> [[GEP_1]], [[VEC]] ; CHECK-NEXT: ret <2 x i1> zeroinitializer ; %gep.1 = getelementptr inbounds i32, <2 x ptr> %vec, i64 1 @@ -39,7 +37,6 @@ define @test.scalable.vectorgep.ult.true( %vec) { ; CHECK-LABEL: @test.scalable.vectorgep.ult.true( ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, [[VEC:%.*]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult [[VEC]], [[GEP_1]] ; CHECK-NEXT: ret shufflevector ( insertelement ( poison, i1 true, i64 0), poison, zeroinitializer) ; %gep.1 = getelementptr inbounds i32, %vec, i64 1 @@ -50,7 +47,6 @@ define @test.scalable.vectorgep.ult.false( %vec) { ; CHECK-LABEL: @test.scalable.vectorgep.ult.false( ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, [[VEC:%.*]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult [[GEP_1]], [[VEC]] ; CHECK-NEXT: ret zeroinitializer ; %gep.1 = getelementptr inbounds i32, %vec, i64 1 diff --git a/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll b/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll --- a/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll +++ b/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll @@ -14,7 +14,6 @@ ; CHECK: check.3.min: ; CHECK-NEXT: [[L0:%.*]] = load i32, ptr [[SRC]], align 4 ; CHECK-NEXT: [[ADD_PTR_I36:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 3 -; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult ptr [[ADD_PTR_I36]], [[MIN]] ; CHECK-NEXT: br i1 false, label [[TRAP]], label [[CHECK_3_MAX:%.*]] ; CHECK: check.3.max: ; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult ptr [[ADD_PTR_I36]], [[MAX]] @@ -22,18 +21,14 @@ ; CHECK: check.1.min: ; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[ADD_PTR_I36]], align 4 ; CHECK-NEXT: [[ADD_PTR_I29:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 1 -; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult ptr [[ADD_PTR_I29]], [[MIN]] ; CHECK-NEXT: br i1 false, label [[TRAP]], label [[CHECK_1_MAX:%.*]] ; CHECK: check.1.max: -; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult ptr [[ADD_PTR_I29]], [[MAX]] ; CHECK-NEXT: br i1 true, label [[CHECK_2_MIN:%.*]], label [[TRAP]] ; CHECK: check.2.min: ; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[ADD_PTR_I29]], align 4 ; CHECK-NEXT: [[ADD_PTR_I:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 2 -; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult ptr [[ADD_PTR_I]], [[MIN]] ; CHECK-NEXT: br i1 false, label [[TRAP]], label [[CHECK_2_MAX:%.*]] ; CHECK: check.2.max: -; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult ptr [[ADD_PTR_I]], [[MAX]] ; CHECK-NEXT: br i1 true, label [[EXIT:%.*]], label [[TRAP]] ; CHECK: exit: ; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[ADD_PTR_I]], align 4 @@ -191,16 +186,12 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ult ptr [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult ptr [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ult ptr [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp ult ptr [[START_4]], [[HIGH]] @@ -294,19 +285,14 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ule ptr [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule ptr [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule ptr [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ule ptr [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 4 -; CHECK-NEXT: [[T_4:%.*]] = icmp ule ptr [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_5:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 5 ; CHECK-NEXT: [[C_5:%.*]] = icmp ule ptr [[START_5]], [[HIGH]] @@ -351,19 +337,14 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt ptr [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt ptr [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt ptr [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp ugt ptr [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 4 -; CHECK-NEXT: [[F_4:%.*]] = icmp ugt ptr [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_5:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 5 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt ptr [[START_5]], [[HIGH]] @@ -408,16 +389,12 @@ ; CHECK: if.then: ; CHECK-NEXT: ret void ; CHECK: if.end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt ptr [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp uge ptr [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp uge ptr [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge ptr [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = getelementptr inbounds i8, ptr [[START]], i64 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge ptr [[START_4]], [[HIGH]] @@ -512,7 +489,6 @@ ; CHECK: check.max: ; CHECK-NEXT: [[IDX_SHL_1:%.*]] = shl nuw nsw i8 [[IDX]], 1 ; CHECK-NEXT: [[ADD_PTR_SHL_1:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i8 [[IDX_SHL_1]] -; CHECK-NEXT: [[C_MAX_0:%.*]] = icmp ult ptr [[ADD_PTR_SHL_1]], [[MAX]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IDX_SHL_2:%.*]] = shl nuw i8 [[IDX]], 2 ; CHECK-NEXT: [[ADD_PTR_SHL_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i8 [[IDX_SHL_2]] @@ -576,7 +552,6 @@ ; CHECK-NEXT: [[IDX_SHL:%.*]] = shl nuw i32 [[IDX]], 1 ; CHECK-NEXT: [[EXT_1:%.*]] = zext i32 [[IDX_SHL]] to i64 ; CHECK-NEXT: [[ADD_PTR_SHL:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 [[EXT_1]] -; CHECK-NEXT: [[C_MAX_0:%.*]] = icmp ult ptr [[ADD_PTR_SHL]], [[MAX]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 1 ; CHECK-NEXT: [[EXT_2:%.*]] = zext i32 [[IDX_SHL_NOT_NUW]] to i64 diff --git a/llvm/test/Transforms/ConstraintElimination/invoke.ll b/llvm/test/Transforms/ConstraintElimination/invoke.ll --- a/llvm/test/Transforms/ConstraintElimination/invoke.ll +++ b/llvm/test/Transforms/ConstraintElimination/invoke.ll @@ -14,14 +14,12 @@ ; CHECK-NEXT: invoke void @may_unwind() ; CHECK-NEXT: to label [[CONT:%.*]] unwind label [[LPAD:%.*]] ; CHECK: cont: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i32 [[X]], 10 ; CHECK-NEXT: [[C_2:%.*]] = icmp ult i32 [[X]], 9 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: ret i1 [[RES_1]] ; CHECK: lpad: ; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 } ; CHECK-NEXT: filter [0 x ptr] zeroinitializer -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i32 [[X]], 10 ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i32 [[X]], 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 true, [[C_3]] ; CHECK-NEXT: ret i1 [[RES_2]] diff --git a/llvm/test/Transforms/ConstraintElimination/large-constant-ints.ll b/llvm/test/Transforms/ConstraintElimination/large-constant-ints.ll --- a/llvm/test/Transforms/ConstraintElimination/large-constant-ints.ll +++ b/llvm/test/Transforms/ConstraintElimination/large-constant-ints.ll @@ -104,7 +104,6 @@ ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: [[SUB_1:%.*]] = sub nuw i80 [[A]], 1973801615886922022913 -; CHECK-NEXT: [[C_1:%.*]] = icmp ult i80 [[SUB_1]], 1346612317380797267967 ; CHECK-NEXT: ret i1 true ; CHECK: else: ; CHECK-NEXT: ret i1 false @@ -131,7 +130,6 @@ ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i8, ptr [[A]], i80 1973801615886922022913 -; CHECK-NEXT: [[C_1:%.*]] = icmp eq ptr [[GEP_1]], null ; CHECK-NEXT: ret i1 true ; CHECK: else: ; CHECK-NEXT: ret i1 false @@ -334,7 +332,6 @@ ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 9223372036854775805 ; CHECK-NEXT: [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: call void @llvm.assume(i1 [[NE]]) -; CHECK-NEXT: [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: [[RES:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RES]] @@ -358,7 +355,6 @@ ; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i64, ptr [[GEP_2]], i64 1152921504606846976 ; CHECK-NEXT: [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_3]] ; CHECK-NEXT: call void @llvm.assume(i1 [[NE]]) -; CHECK-NEXT: [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_3]] ; CHECK-NEXT: [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_3]] ; CHECK-NEXT: [[RES:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RES]] @@ -384,7 +380,6 @@ ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds [[STRUCT:%.*]], ptr [[A]], i64 8937376004704240, i32 1, i32 1 ; CHECK-NEXT: [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: call void @llvm.assume(i1 [[NE]]) -; CHECK-NEXT: [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]] ; CHECK-NEXT: [[RES:%.*]] = xor i1 false, false ; CHECK-NEXT: ret i1 [[RES]] diff --git a/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll b/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll --- a/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll +++ b/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll @@ -21,7 +21,6 @@ ; CHECK-NEXT: [[TMP36:%.*]] = icmp ult ptr [[Y]], [[Z]] ; CHECK-NEXT: br i1 [[TMP36]], label [[EARLY_EXIT]], label [[BB38:%.*]] ; CHECK: bb38: -; CHECK-NEXT: [[TMP41:%.*]] = icmp ult ptr [[Y]], [[Z]] ; CHECK-NEXT: br i1 false, label [[EARLY_EXIT]], label [[BB43:%.*]] ; CHECK: bb43: ; CHECK-NEXT: [[TMP47:%.*]] = getelementptr inbounds i8, ptr [[W:%.*]], i64 [[X]] @@ -35,7 +34,6 @@ ; CHECK-NEXT: [[TMP57:%.*]] = icmp ult ptr [[W]], [[Y]] ; CHECK-NEXT: br i1 [[TMP57]], label [[BB59:%.*]], label [[EARLY_EXIT]] ; CHECK: bb59: -; CHECK-NEXT: [[TMP60:%.*]] = icmp ult ptr [[W]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-base.ll b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-base.ll --- a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-base.ll +++ b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-base.ll @@ -12,9 +12,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp slt i32 [[X]], [[N:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[F_1:%.*]] = icmp sle i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[T_2]]) @@ -76,9 +74,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp slt i32 [[X]], [[N:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[F_1:%.*]] = icmp sle i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[X]], -10 ; CHECK-NEXT: call void @use(i1 [[T_2]]) @@ -144,9 +140,7 @@ ; CHECK-NEXT: call void @use(i1 [[F_1]]) ; CHECK-NEXT: [[T_1:%.*]] = icmp sgt i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 [[T_1]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[X]], 0 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp sge i32 [[X]], -1 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp sle i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -208,9 +202,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i32 [[X]], [[N:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[X]], [[N]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -260,13 +252,9 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[X_NEXT]] = add i32 [[X]], 1 ; CHECK-NEXT: br label [[LOOP_HEADER]] @@ -323,7 +311,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[IV]], [[N]] ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_LATCH]], label [[EXIT:%.*]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i32 [[IV]], [[N]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i32 [[IV]], 2 ; CHECK-NEXT: call void @use(i1 [[C_3]]) @@ -389,11 +376,8 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[IV]], 2 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_LATCH]], label [[EXIT:%.*]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i32 [[IV]], 2 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_3:%.*]] = icmp ult i32 [[IV]], 2 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[C_4:%.*]] = icmp ugt i32 [[IV]], 1 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 ; CHECK-NEXT: br label [[LOOP_HEADER]] diff --git a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll --- a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll +++ b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll @@ -660,7 +660,6 @@ ; CHECK: loop.latch: ; CHECK-NEXT: [[DST_UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[TMP0]] ; CHECK-NEXT: [[DST_IDX:%.*]] = getelementptr inbounds i32, ptr [[DST]], i64 [[IDXPROM]] -; CHECK-NEXT: [[CMP_DST_IDX_UPPER:%.*]] = icmp ult ptr [[DST_IDX]], [[DST_UPPER]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: br i1 true, label [[LOOP_LATCH_2]], label [[EXIT]] ; CHECK: loop.latch.2: diff --git a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll --- a/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll +++ b/llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-iv.ll @@ -17,7 +17,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule ptr [[IV]], [[END]] ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult ptr [[IV]], [[UPPER]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IV_NEXT]] = getelementptr inbounds i8, ptr [[IV]], i8 1 ; CHECK-NEXT: br label [[LOOP_HEADER]] @@ -61,7 +60,6 @@ ; CHECK-NEXT: [[C_3:%.*]] = icmp ule ptr [[IV]], [[END]] ; CHECK-NEXT: br i1 [[C_3]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[C_4:%.*]] = icmp ult ptr [[IV]], [[UPPER]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[IV_NEXT]] = getelementptr inbounds i8, ptr [[IV]], i8 1 ; CHECK-NEXT: br label [[LOOP_HEADER]] diff --git a/llvm/test/Transforms/ConstraintElimination/loops.ll b/llvm/test/Transforms/ConstraintElimination/loops.ll --- a/llvm/test/Transforms/ConstraintElimination/loops.ll +++ b/llvm/test/Transforms/ConstraintElimination/loops.ll @@ -60,9 +60,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP_LATCH]], label [[EXIT]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -112,9 +110,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[EXIT]], label [[LOOP_LATCH]] ; CHECK: loop.latch: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -166,17 +162,13 @@ ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[OR]], label [[EXIT]], label [[LOOP_LATCH]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i32 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i32 [[Y]], 99 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i32 [[Y]], 99 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_3:%.*]] = icmp ule i32 [[Y]], 98 ; CHECK-NEXT: call void @use(i1 [[C_3]]) @@ -319,17 +311,13 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[X_1]], [[Y_1]] ; CHECK-NEXT: br i1 [[AND]], label [[LOOP_LATCH]], label [[EXIT_1:%.*]] ; CHECK: loop.latch: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_1]]) ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i32 [[Y]], 99 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i32 [[Y]], 99 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i32 [[Y]], 100 ; CHECK-NEXT: call void @use(i1 [[C_3]]) @@ -421,7 +409,6 @@ ; CHECK-NEXT: [[X_NEXT]] = add i32 [[X]], 1 ; CHECK-NEXT: br label [[LOOP_HEADER]] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i32 [[Y]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/ConstraintElimination/max-row-limit.ll b/llvm/test/Transforms/ConstraintElimination/max-row-limit.ll --- a/llvm/test/Transforms/ConstraintElimination/max-row-limit.ll +++ b/llvm/test/Transforms/ConstraintElimination/max-row-limit.ll @@ -5,28 +5,48 @@ define i1 @test_max_row_limit(i32 %l0, i32 %l1, i32 %l2, i32 %l3, i32 %l4) { -; COMMON-LABEL: @test_max_row_limit( -; COMMON-NEXT: bb0: -; COMMON-NEXT: [[C0:%.*]] = icmp uge i32 [[L0:%.*]], 100 -; COMMON-NEXT: br i1 [[C0]], label [[BB1:%.*]], label [[EXIT:%.*]] -; COMMON: bb1: -; COMMON-NEXT: [[C1:%.*]] = icmp uge i32 [[L1:%.*]], 100 -; COMMON-NEXT: br i1 [[C1]], label [[BB2:%.*]], label [[EXIT]] -; COMMON: bb2: -; COMMON-NEXT: [[C2:%.*]] = icmp uge i32 [[L2:%.*]], 100 -; COMMON-NEXT: br i1 [[C2]], label [[BB3:%.*]], label [[EXIT]] -; COMMON: bb3: -; COMMON-NEXT: [[C3:%.*]] = icmp uge i32 [[L3:%.*]], 100 -; COMMON-NEXT: br i1 [[C3]], label [[BB4:%.*]], label [[EXIT]] -; COMMON: bb4: -; COMMON-NEXT: [[C4:%.*]] = icmp uge i32 [[L4:%.*]], 100 -; COMMON-NEXT: br i1 [[C4]], label [[BB5:%.*]], label [[EXIT]] -; COMMON: bb5: -; COMMON-NEXT: [[C5:%.*]] = icmp uge i32 [[L4]], 100 -; SIMP-NEXT: ret i1 true +; SIMP-LABEL: @test_max_row_limit( +; SIMP-NEXT: bb0: +; SIMP-NEXT: [[C0:%.*]] = icmp uge i32 [[L0:%.*]], 100 +; SIMP-NEXT: br i1 [[C0]], label [[BB1:%.*]], label [[EXIT:%.*]] +; SIMP: bb1: +; SIMP-NEXT: [[C1:%.*]] = icmp uge i32 [[L1:%.*]], 100 +; SIMP-NEXT: br i1 [[C1]], label [[BB2:%.*]], label [[EXIT]] +; SIMP: bb2: +; SIMP-NEXT: [[C2:%.*]] = icmp uge i32 [[L2:%.*]], 100 +; SIMP-NEXT: br i1 [[C2]], label [[BB3:%.*]], label [[EXIT]] +; SIMP: bb3: +; SIMP-NEXT: [[C3:%.*]] = icmp uge i32 [[L3:%.*]], 100 +; SIMP-NEXT: br i1 [[C3]], label [[BB4:%.*]], label [[EXIT]] +; SIMP: bb4: +; SIMP-NEXT: [[C4:%.*]] = icmp uge i32 [[L4:%.*]], 100 +; SIMP-NEXT: br i1 [[C4]], label [[BB5:%.*]], label [[EXIT]] +; SIMP: bb5: +; SIMP-NEXT: ret i1 true +; SIMP: exit: +; SIMP-NEXT: ret i1 false +; +; NOSIMP-LABEL: @test_max_row_limit( +; NOSIMP-NEXT: bb0: +; NOSIMP-NEXT: [[C0:%.*]] = icmp uge i32 [[L0:%.*]], 100 +; NOSIMP-NEXT: br i1 [[C0]], label [[BB1:%.*]], label [[EXIT:%.*]] +; NOSIMP: bb1: +; NOSIMP-NEXT: [[C1:%.*]] = icmp uge i32 [[L1:%.*]], 100 +; NOSIMP-NEXT: br i1 [[C1]], label [[BB2:%.*]], label [[EXIT]] +; NOSIMP: bb2: +; NOSIMP-NEXT: [[C2:%.*]] = icmp uge i32 [[L2:%.*]], 100 +; NOSIMP-NEXT: br i1 [[C2]], label [[BB3:%.*]], label [[EXIT]] +; NOSIMP: bb3: +; NOSIMP-NEXT: [[C3:%.*]] = icmp uge i32 [[L3:%.*]], 100 +; NOSIMP-NEXT: br i1 [[C3]], label [[BB4:%.*]], label [[EXIT]] +; NOSIMP: bb4: +; NOSIMP-NEXT: [[C4:%.*]] = icmp uge i32 [[L4:%.*]], 100 +; NOSIMP-NEXT: br i1 [[C4]], label [[BB5:%.*]], label [[EXIT]] +; NOSIMP: bb5: +; NOSIMP-NEXT: [[C5:%.*]] = icmp uge i32 [[L4]], 100 ; NOSIMP-NEXT: ret i1 [[C5]] -; COMMON: exit: -; COMMON-NEXT: ret i1 false +; NOSIMP: exit: +; NOSIMP-NEXT: ret i1 false ; bb0: %c0 = icmp uge i32 %l0, 100 @@ -55,3 +75,5 @@ exit: ret i1 false } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; COMMON: {{.*}} diff --git a/llvm/test/Transforms/ConstraintElimination/minmax.ll b/llvm/test/Transforms/ConstraintElimination/minmax.ll --- a/llvm/test/Transforms/ConstraintElimination/minmax.ll +++ b/llvm/test/Transforms/ConstraintElimination/minmax.ll @@ -9,8 +9,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[Y]], [[MAX]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -38,7 +36,6 @@ ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 [[CMP2]], true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -65,8 +62,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[Y]], [[MIN]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -94,7 +89,6 @@ ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 [[CMP2]], true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -121,8 +115,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[Y]], [[MAX]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp sge i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -150,7 +142,6 @@ ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp sge i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 [[CMP2]], true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -177,8 +168,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[Y]], [[MIN]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp sle i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -206,7 +195,6 @@ ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[Y]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp sle i32 [[Y]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 [[CMP2]], true ; CHECK-NEXT: ret i1 [[RET]] ; CHECK: end: @@ -234,7 +222,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[Y]], [[SUM]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[Y]], [[X]] ; CHECK-NEXT: ret i1 true ; CHECK: end: ; CHECK-NEXT: ret i1 false @@ -295,8 +282,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[Z]], [[MAX]] ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[END:%.*]] ; CHECK: if: -; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[Z]], [[X]] -; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[Z]], [[Y]] ; CHECK-NEXT: [[AND:%.*]] = xor i1 true, true ; CHECK-NEXT: ret i1 [[AND]] ; CHECK: end: @@ -321,8 +306,6 @@ ; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[MIN:%.*]] = call i32 @llvm.smin.i32(i32 [[X]], i32 [[Y]]) -; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i32 [[MIN]], [[X]] -; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[MIN]], [[X]] ; CHECK-NEXT: [[RET:%.*]] = xor i1 true, false ; CHECK-NEXT: ret i1 [[RET]] ; diff --git a/llvm/test/Transforms/ConstraintElimination/mixed-signed-unsigned-predicates.ll b/llvm/test/Transforms/ConstraintElimination/mixed-signed-unsigned-predicates.ll --- a/llvm/test/Transforms/ConstraintElimination/mixed-signed-unsigned-predicates.ll +++ b/llvm/test/Transforms/ConstraintElimination/mixed-signed-unsigned-predicates.ll @@ -13,7 +13,6 @@ ; CHECK-NEXT: [[UC_4:%.*]] = icmp uge i8 [[START_1_1]], [[HIGH]] ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 [[UC_3]], [[UC_4]] ; CHECK-NEXT: [[START_3_1:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_0:%.*]] = icmp uge i8 [[START_3_1]], [[HIGH]] ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], true ; CHECK-NEXT: [[UC_5:%.*]] = icmp ugt i8 [[START_3_1]], [[HIGH]] ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], [[UC_5]] @@ -23,23 +22,19 @@ ; CHECK-NEXT: [[RES_15:%.*]] = xor i1 [[RES_14]], [[SC_9]] ; CHECK-NEXT: ret i1 [[RES_15]] ; CHECK: if.else: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: [[RES_0:%.*]] = xor i1 false, false ; CHECK-NEXT: [[SC_1:%.*]] = icmp sgt i8 [[START]], [[HIGH]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[RES_0]], [[SC_1]] ; CHECK-NEXT: [[SC_2:%.*]] = icmp sge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[SC_2]] ; CHECK-NEXT: [[START_2:%.*]] = add nuw i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], false ; CHECK-NEXT: [[SC_3:%.*]] = icmp sge i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[SC_3]] ; CHECK-NEXT: [[SC_4:%.*]] = icmp sle i8 [[START_2]], [[START_1]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], [[SC_4]] ; CHECK-NEXT: [[START_3:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], false ; CHECK-NEXT: [[SC_5:%.*]] = icmp sge i8 [[START_3]], [[START_1]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[SC_5]] @@ -147,7 +142,6 @@ ; CHECK-NEXT: [[START_1:%.*]] = add nuw i8 [[START]], 1 ; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: [[RES_0:%.*]] = xor i1 [[F_0]], [[F_1]] -; CHECK-NEXT: [[SC_1:%.*]] = icmp sgt i8 [[START]], [[HIGH]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[RES_0]], false ; CHECK-NEXT: [[SC_2:%.*]] = icmp sge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[SC_2]] @@ -248,14 +242,10 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[ADD_PTR_I]], [[HIGH:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] ; CHECK: if.then: -; CHECK-NEXT: [[UC_3:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: [[START_1_1:%.*]] = sub nuw i8 [[START]], 1 -; CHECK-NEXT: [[UC_4:%.*]] = icmp uge i8 [[START_1_1]], [[HIGH]] ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 true, true ; CHECK-NEXT: [[START_3_1:%.*]] = add nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_0:%.*]] = icmp uge i8 [[START_3_1]], [[HIGH]] ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], true -; CHECK-NEXT: [[UC_5:%.*]] = icmp ugt i8 [[START_3_1]], [[HIGH]] ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], true ; CHECK-NEXT: [[SC_8:%.*]] = icmp sge i8 [[START_1_1]], [[HIGH]] ; CHECK-NEXT: [[RES_14:%.*]] = xor i1 [[RES_13]], [[SC_8]] @@ -279,12 +269,10 @@ ; CHECK-NEXT: [[SC_4:%.*]] = icmp sle i8 [[START_2]], [[START_1]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], [[SC_4]] ; CHECK-NEXT: [[START_3:%.*]] = sub nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], false ; CHECK-NEXT: [[SC_5:%.*]] = icmp sge i8 [[START_3]], [[START_1]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[SC_5]] ; CHECK-NEXT: [[START_4:%.*]] = sub nuw i8 [[START]], 4 -; CHECK-NEXT: [[UC_2:%.*]] = icmp uge i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], false ; CHECK-NEXT: [[SC_6:%.*]] = icmp sge i8 [[START_4]], [[START_1]] ; CHECK-NEXT: [[RES_9:%.*]] = xor i1 [[RES_8]], [[SC_6]] @@ -370,7 +358,6 @@ ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: [[UC_1:%.*]] = icmp ule i32 [[X]], [[Z]] -; CHECK-NEXT: [[UC_2:%.*]] = icmp ule i32 [[X]], [[Y]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[UC_1]], true ; CHECK-NEXT: [[UC_3:%.*]] = icmp ule i32 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[UC_3]] @@ -380,7 +367,6 @@ ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], [[SC_1]] ; CHECK-NEXT: [[SC_2:%.*]] = icmp sle i32 [[X]], [[Y]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[SC_2]] -; CHECK-NEXT: [[SC_3:%.*]] = icmp sle i32 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], true ; CHECK-NEXT: [[SC_4:%.*]] = icmp sle i32 [[X]], [[A]] ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[SC_4]] diff --git a/llvm/test/Transforms/ConstraintElimination/mul-nsw.ll b/llvm/test/Transforms/ConstraintElimination/mul-nsw.ll --- a/llvm/test/Transforms/ConstraintElimination/mul-nsw.ll +++ b/llvm/test/Transforms/ConstraintElimination/mul-nsw.ll @@ -13,16 +13,12 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = mul nsw i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = mul nsw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = mul nsw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = mul nsw i8 [[START]], 4 ; CHECK-NEXT: [[C_3:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] @@ -335,16 +331,12 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = mul nsw i8 [[START]], -1 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = mul nsw i8 [[START]], -2 -; CHECK-NEXT: [[T_2:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = mul nsw i8 [[START]], -3 -; CHECK-NEXT: [[T_3:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = mul nsw i8 [[START]], -4 ; CHECK-NEXT: [[C_3:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] @@ -454,10 +446,8 @@ ; CHECK-NEXT: [[C_5:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) ; CHECK-NEXT: [[START_3:%.*]] = mul nsw i8 [[START]], 3 -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = mul nsw i8 [[START]], 4 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; CHECK: else: @@ -564,10 +554,8 @@ ; CHECK-NEXT: [[C_5:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) ; CHECK-NEXT: [[START_3:%.*]] = mul nsw i8 [[START]], -3 -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = mul nsw i8 [[START]], -4 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; CHECK: else: @@ -665,16 +653,12 @@ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], [[C_2]] ; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_0:%.*]] = icmp slt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = mul nsw i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = mul nsw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp slt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = mul nsw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp slt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = mul nsw i8 [[START]], 4 ; CHECK-NEXT: [[C_3:%.*]] = icmp slt i8 [[START_4]], [[HIGH]] diff --git a/llvm/test/Transforms/ConstraintElimination/mul.ll b/llvm/test/Transforms/ConstraintElimination/mul.ll --- a/llvm/test/Transforms/ConstraintElimination/mul.ll +++ b/llvm/test/Transforms/ConstraintElimination/mul.ll @@ -49,7 +49,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_MUL_2:%.*]] = mul nuw i8 [[START]], 2 ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] -; CHECK-NEXT: [[T:%.*]] = icmp ule i8 [[START_ADD_1]], [[START_MUL_2]] ; CHECK-NEXT: ret i1 true ; entry: @@ -72,7 +71,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_MUL_2:%.*]] = mul nuw i8 [[START]], 2 ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] -; CHECK-NEXT: [[F:%.*]] = icmp ult i8 [[START_ADD_1]], [[START_MUL_2]] ; CHECK-NEXT: ret i1 false ; entry: @@ -95,7 +93,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[START_ADD_2]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 true ; entry: @@ -117,7 +114,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] -; CHECK-NEXT: [[F_2:%.*]] = icmp ult i8 [[START_ADD_2]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 false ; entry: @@ -141,7 +137,6 @@ ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] ; CHECK-NEXT: [[START_ADD_2_1:%.*]] = add nuw i8 [[START_ADD_2]], 1 -; CHECK-NEXT: [[F_3:%.*]] = icmp ule i8 [[START_ADD_2_1]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 false ; entry: @@ -220,7 +215,6 @@ ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8 [[START]], [[START_MUL_5]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_0]]) ; CHECK-NEXT: [[START_MUL_3:%.*]] = mul nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_MUL_3]], [[START_MUL_5]] ; CHECK-NEXT: ret i1 true ; entry: @@ -240,7 +234,6 @@ ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8 [[START]], [[START_MUL_5]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_0]]) ; CHECK-NEXT: [[START_MUL_3:%.*]] = mul nuw i8 [[START]], 3 -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[START_MUL_5]], [[START_MUL_3]] ; CHECK-NEXT: ret i1 false ; entry: @@ -260,7 +253,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START]], [[START_MUL_3]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_MUL_5:%.*]] = mul nuw i8 [[START]], 5 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_MUL_3]], [[START_MUL_5]] ; CHECK-NEXT: ret i1 true ; entry: @@ -280,7 +272,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START]], [[START_MUL_3]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_MUL_5:%.*]] = mul nuw i8 [[START]], 5 -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[START_MUL_5]], [[START_MUL_3]] ; CHECK-NEXT: ret i1 false ; entry: @@ -424,7 +415,6 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[START_ADD_2]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 true ; entry: @@ -449,7 +439,6 @@ ; CHECK-NEXT: [[START_MUL_2:%.*]] = mul nuw i8 [[START]], 2 ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] -; CHECK-NEXT: [[T_4:%.*]] = icmp ult i8 [[START_ADD_2]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 true ; entry: @@ -475,7 +464,6 @@ ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] ; CHECK-NEXT: [[START_ADD_2_12:%.*]] = add nuw i8 [[START_ADD_2]], 12 -; CHECK-NEXT: [[T_5:%.*]] = icmp ule i8 [[START_ADD_2_12]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 true ; entry: @@ -501,7 +489,6 @@ ; CHECK-NEXT: [[START_ADD_1:%.*]] = add nuw i8 [[START]], [[START]] ; CHECK-NEXT: [[START_ADD_2:%.*]] = add nuw i8 [[START_ADD_1]], [[START_ADD_1]] ; CHECK-NEXT: [[START_ADD_2_13:%.*]] = add nuw i8 [[START_ADD_2]], 13 -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[START_ADD_2_13]], [[START_MUL_4]] ; CHECK-NEXT: ret i1 false ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/ne.ll b/llvm/test/Transforms/ConstraintElimination/ne.ll --- a/llvm/test/Transforms/ConstraintElimination/ne.ll +++ b/llvm/test/Transforms/ConstraintElimination/ne.ll @@ -9,14 +9,11 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], 0 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0 -; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, true ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: else: -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 0 ; CHECK-NEXT: [[C_3:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[C_4:%.*]] = icmp ne i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 true, [[C_3]] @@ -50,18 +47,14 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[A:%.*]], 0 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 0 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp eq i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[C_3]] -; CHECK-NEXT: [[C_4:%.*]] = icmp eq i8 [[A]], 0 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], false -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i8 [[A]], 0 ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true -; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 [[A]], 1 ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], true ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[A]], 1 ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[C_5]] @@ -69,20 +62,14 @@ ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_6]] ; CHECK-NEXT: ret i1 [[RES_8]] ; CHECK: else: -; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0 -; CHECK-NEXT: [[C_7:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[RES_9:%.*]] = xor i1 false, true ; CHECK-NEXT: [[C_8:%.*]] = icmp ne i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_10:%.*]] = xor i1 [[RES_9]], [[C_8]] ; CHECK-NEXT: [[C_9:%.*]] = icmp eq i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 [[RES_10]], [[C_9]] -; CHECK-NEXT: [[C_10:%.*]] = icmp eq i8 [[A]], 0 ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], true -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[A]], 0 ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], false -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[A]], 1 ; CHECK-NEXT: [[RES_14:%.*]] = xor i1 [[RES_13]], false -; CHECK-NEXT: [[C_11:%.*]] = icmp ugt i8 [[A]], 1 ; CHECK-NEXT: [[RES_15:%.*]] = xor i1 [[RES_14]], false ; CHECK-NEXT: [[C_12:%.*]] = icmp sgt i8 [[A]], 0 ; CHECK-NEXT: [[RES_16:%.*]] = xor i1 [[RES_15]], [[C_12]] @@ -155,8 +142,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], 1 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0 -; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]] @@ -215,20 +200,14 @@ ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_6]] ; CHECK-NEXT: ret i1 [[RES_8]] ; CHECK: else: -; CHECK-NEXT: [[T_2:%.*]] = icmp ne i8 [[A]], 0 -; CHECK-NEXT: [[C_9:%.*]] = icmp ne i8 [[A]], 1 ; CHECK-NEXT: [[RES_9:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_10:%.*]] = icmp ne i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_10:%.*]] = xor i1 [[RES_9]], [[C_10]] ; CHECK-NEXT: [[C_11:%.*]] = icmp eq i8 [[A]], [[B]] ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 [[RES_10]], [[C_11]] -; CHECK-NEXT: [[F_1:%.*]] = icmp eq i8 [[A]], 0 ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], false -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i8 [[A]], 0 ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp uge i8 [[A]], 1 ; CHECK-NEXT: [[RES_14:%.*]] = xor i1 [[RES_13]], true -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[A]], 1 ; CHECK-NEXT: [[RES_15:%.*]] = xor i1 [[RES_14]], false ; CHECK-NEXT: [[C_12:%.*]] = icmp sgt i8 [[A]], 0 ; CHECK-NEXT: [[RES_16:%.*]] = xor i1 [[RES_15]], [[C_12]] @@ -300,7 +279,6 @@ ; CHECK-NEXT: [[TMP1:%.*]] = add nuw i64 [[B:%.*]], 1 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i64 [[TMP1]], [[A:%.*]] ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP2]]) -; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i64 [[A]], [[B]] ; CHECK-NEXT: ret i1 true ; %1 = add nuw i64 %b, 1 @@ -316,7 +294,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP1]]) ; CHECK-NEXT: [[TMP2:%.*]] = icmp uge i64 [[B]], [[C:%.*]] ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP2]]) -; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i64 [[A]], [[C]] ; CHECK-NEXT: ret i1 true ; %1 = icmp ugt i64 %a, %b diff --git a/llvm/test/Transforms/ConstraintElimination/or.ll b/llvm/test/Transforms/ConstraintElimination/or.ll --- a/llvm/test/Transforms/ConstraintElimination/or.ll +++ b/llvm/test/Transforms/ConstraintElimination/or.ll @@ -17,15 +17,11 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; @@ -78,15 +74,11 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: call void @use(i1 [[C_5]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; @@ -143,16 +135,10 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_7]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i4 2, [[X]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, false -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp ugt i4 2, [[A]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], true ; CHECK-NEXT: [[C_8:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_8]] @@ -224,16 +210,10 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_7]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[F_2:%.*]] = icmp ule i4 2, [[X]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, false -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], true -; CHECK-NEXT: [[T_4:%.*]] = icmp ugt i4 2, [[A]] ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], true ; CHECK-NEXT: [[C_8:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_8]] @@ -306,12 +286,8 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_7]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[C_8:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[C_8]] @@ -371,12 +347,8 @@ ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_7]] ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: exit: -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i4 [[X]], [[Z]] -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i4 [[Y]], [[Z]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i4 [[X]], [[Y]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], true -; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i4 [[X]], [[Z]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true ; CHECK-NEXT: [[C_8:%.*]] = icmp ule i4 [[X]], [[A]] ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[C_8]] @@ -450,16 +422,12 @@ ; CHECK-NEXT: call void @use(i1 [[F_2]]) ; CHECK-NEXT: ret void ; CHECK: end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ult i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = or i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = or i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = or i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ult i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = or i8 [[START]], 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp ult i8 [[START_4]], [[HIGH]] @@ -519,16 +487,12 @@ ; CHECK-NEXT: call void @use(i1 [[F_2]]) ; CHECK-NEXT: ret void ; CHECK: end: -; CHECK-NEXT: [[T_0:%.*]] = icmp ule i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_1:%.*]] = or i8 [[START]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_2:%.*]] = or i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = or i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = or i8 [[START]], 4 ; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[START_4]], [[HIGH]] @@ -595,16 +559,12 @@ ; CHECK-NEXT: call void @use(i1 [[T_2]]) ; CHECK-NEXT: ret void ; CHECK: end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = or i8 [[START]], 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = or i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = or i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp ugt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = or i8 [[START]], 4 ; CHECK-NEXT: [[F_4:%.*]] = icmp ugt i8 [[START_4]], [[HIGH]] @@ -670,16 +630,12 @@ ; CHECK-NEXT: call void @use(i1 [[T_2]]) ; CHECK-NEXT: ret void ; CHECK: end: -; CHECK-NEXT: [[F_0:%.*]] = icmp ugt i8 [[START]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_1:%.*]] = or i8 [[START]], 1 -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_2:%.*]] = or i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = or i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = or i8 [[START]], 4 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 [[START_4]], [[HIGH]] diff --git a/llvm/test/Transforms/ConstraintElimination/pointercast.ll b/llvm/test/Transforms/ConstraintElimination/pointercast.ll --- a/llvm/test/Transforms/ConstraintElimination/pointercast.ll +++ b/llvm/test/Transforms/ConstraintElimination/pointercast.ll @@ -15,19 +15,13 @@ ; CHECK: trap: ; CHECK-NEXT: ret i1 false ; CHECK: checks: -; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult ptr [[GEP_3]], [[MIN]] ; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult ptr [[GEP_3]], [[MAX]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[C_3_MAX]] ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 1 -; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult ptr [[GEP_1]], [[MIN]] -; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult ptr [[GEP_1]], [[MAX]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 false, true ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 2 -; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult ptr [[GEP_2]], [[MIN]] -; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult ptr [[GEP_2]], [[MAX]] ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true ; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 4 -; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult ptr [[GEP_4]], [[MIN]] ; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult ptr [[GEP_4]], [[MAX]] ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 false, [[C_4_MAX]] ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_1]], [[RES_2]] diff --git a/llvm/test/Transforms/ConstraintElimination/range_checks.ll b/llvm/test/Transforms/ConstraintElimination/range_checks.ll --- a/llvm/test/Transforms/ConstraintElimination/range_checks.ll +++ b/llvm/test/Transforms/ConstraintElimination/range_checks.ll @@ -17,7 +17,6 @@ ; CHECK-NEXT: [[IN_BOUNDS:%.*]] = icmp ult i32 [[IDX]], [[MIN_LENGTH:%.*]] ; CHECK-NEXT: br i1 [[IN_BOUNDS]], label [[RANGE_CHECK_BLOCK:%.*]], label [[OUT_OF_BOUNDS:%.*]] ; CHECK: range_check_block: -; CHECK-NEXT: [[RANGE_CHECK:%.*]] = icmp ult i32 [[IDX]], [[MIN_LENGTH]] ; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[RANGE_CHECK_FAILED:%.*]] ; CHECK: backedge: ; CHECK-NEXT: [[ARR_PTR:%.*]] = getelementptr i32, ptr [[ARRAY:%.*]], i32 [[IDX]] @@ -81,7 +80,6 @@ ; CHECK-NEXT: [[IN_BOUNDS:%.*]] = icmp ult i32 [[IDX]], [[MIN_LENGTH]] ; CHECK-NEXT: br i1 [[IN_BOUNDS]], label [[RANGE_CHECK_BLOCK:%.*]], label [[OUT_OF_BOUNDS:%.*]] ; CHECK: range_check_block: -; CHECK-NEXT: [[RANGE_CHECK:%.*]] = icmp ult i32 [[IDX]], [[LENGTH]] ; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[RANGE_CHECK_FAILED:%.*]] ; CHECK: backedge: ; CHECK-NEXT: [[ARR_PTR:%.*]] = getelementptr i32, ptr [[ARRAY:%.*]], i32 [[IDX]] diff --git a/llvm/test/Transforms/ConstraintElimination/sge.ll b/llvm/test/Transforms/ConstraintElimination/sge.ll --- a/llvm/test/Transforms/ConstraintElimination/sge.ll +++ b/llvm/test/Transforms/ConstraintElimination/sge.ll @@ -9,7 +9,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i32 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -19,9 +18,7 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i32 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -62,9 +59,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i32 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -72,11 +67,8 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_3:%.*]] = icmp sge i32 11, [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1_1:%.*]] = icmp sge i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp sge i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -124,7 +116,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp sge i32 [[X]], [[Z]] ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: ; CHECK-NEXT: ret i32 10 @@ -223,7 +214,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i32 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[U_1:%.*]] = icmp eq i32 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[U_1]]) @@ -257,10 +247,8 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp sgt i32 [[X:%.*]], -1 ; CHECK-NEXT: br i1 [[C_1]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i32 [[X]], 0 ; CHECK-NEXT: ret i1 true ; CHECK: else: -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i32 [[X]], 0 ; CHECK-NEXT: ret i1 false ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/shl.ll b/llvm/test/Transforms/ConstraintElimination/shl.ll --- a/llvm/test/Transforms/ConstraintElimination/shl.ll +++ b/llvm/test/Transforms/ConstraintElimination/shl.ll @@ -219,7 +219,6 @@ ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8 [[START]], [[START_SHL_5]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_0]]) ; CHECK-NEXT: [[START_SHL_3:%.*]] = shl nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_SHL_3]], [[START_SHL_5]] ; CHECK-NEXT: ret i1 true ; entry: @@ -239,7 +238,6 @@ ; CHECK-NEXT: [[C_0:%.*]] = icmp ult i8 [[START]], [[START_SHL_5]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_0]]) ; CHECK-NEXT: [[START_SHL_3:%.*]] = shl nuw i8 [[START]], 3 -; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[START_SHL_5]], [[START_SHL_3]] ; CHECK-NEXT: ret i1 false ; entry: @@ -259,7 +257,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[START]], [[START_SHL_3]] ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]]) ; CHECK-NEXT: [[START_SHL_5:%.*]] = shl nuw i8 [[START]], 5 -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_SHL_3]], [[START_SHL_5]] ; CHECK-NEXT: ret i1 true ; entry: @@ -1280,7 +1277,6 @@ ; CHECK-LABEL: @shl_55( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[SHL_UB:%.*]] = shl nuw nsw i256 1, 55 -; CHECK-NEXT: [[SHL_CMP:%.*]] = icmp uge i256 [[SHL_UB]], 1 ; CHECK-NEXT: ret i1 true ; entry: diff --git a/llvm/test/Transforms/ConstraintElimination/signed-query-unsigned-system.ll b/llvm/test/Transforms/ConstraintElimination/signed-query-unsigned-system.ll --- a/llvm/test/Transforms/ConstraintElimination/signed-query-unsigned-system.ll +++ b/llvm/test/Transforms/ConstraintElimination/signed-query-unsigned-system.ll @@ -8,7 +8,6 @@ ; CHECK-NEXT: [[A_NE_0:%.*]] = icmp ne i8 [[A:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_NE_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sge i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.ne.0 = icmp ne i8 %a, 0 @@ -23,7 +22,6 @@ ; CHECK-NEXT: [[A_NE_0:%.*]] = icmp ne i8 [[A:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_NE_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sgt i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.ne.0 = icmp ne i8 %a, 0 @@ -38,7 +36,6 @@ ; CHECK-NEXT: [[A_SGT_0:%.*]] = icmp sgt i8 [[A:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGT_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sgt i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.sgt.0 = icmp sgt i8 %a, 0 @@ -53,7 +50,6 @@ ; CHECK-NEXT: [[A_SGE_0:%.*]] = icmp sge i8 [[A:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_SGE_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sge i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.sge.0 = icmp sge i8 %a, 0 @@ -68,7 +64,6 @@ ; CHECK-NEXT: [[A_UGT_0:%.*]] = icmp ugt i8 [[A:%.*]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_UGT_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sgt i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.ugt.0 = icmp ugt i8 %a, 0 @@ -98,7 +93,6 @@ ; CHECK-NEXT: [[A_UGT_1:%.*]] = icmp ugt i8 [[A:%.*]], 1 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_UGT_1]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[T:%.*]] = icmp sgt i16 [[EXT]], 1 ; CHECK-NEXT: ret i1 true ; %a.ugt.1 = icmp ugt i8 %a, 1 @@ -133,7 +127,6 @@ ; CHECK-NEXT: [[A_UGT_0:%.*]] = icmp ugt i8 [[A:%.*]], 10 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_UGT_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[EXT]], 0 ; CHECK-NEXT: ret i1 true ; %a.ugt.0 = icmp ugt i8 %a, 10 @@ -148,7 +141,6 @@ ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[A:%.*]] to i16 ; CHECK-NEXT: [[A_NE_0:%.*]] = icmp sge i16 [[EXT]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[A_NE_0]]) -; CHECK-NEXT: [[T:%.*]] = icmp sge i16 [[EXT]], -1 ; CHECK-NEXT: ret i1 true ; %ext = zext i8 %a to i16 diff --git a/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll b/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll --- a/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll +++ b/llvm/test/Transforms/ConstraintElimination/sub-nuw.ll @@ -19,10 +19,8 @@ ; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[T_2]]) ; CHECK-NEXT: [[START_3:%.*]] = sub nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ult i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = sub nuw i8 [[START]], 4 -; CHECK-NEXT: [[C_4:%.*]] = icmp ult i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; @@ -67,16 +65,12 @@ ; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[T_1]]) ; CHECK-NEXT: [[START_2:%.*]] = sub nuw i8 [[START]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_3:%.*]] = sub nuw i8 [[START]], 3 -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_4:%.*]] = sub nuw i8 [[START]], 4 -; CHECK-NEXT: [[T_4:%.*]] = icmp ule i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[START_5:%.*]] = sub nuw i8 [[START]], 5 -; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[START_5]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; @@ -126,16 +120,12 @@ ; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i8 [[START_1]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[F_1]]) ; CHECK-NEXT: [[START_2:%.*]] = sub nuw i8 [[START]], 2 -; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_3:%.*]] = sub nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp ugt i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = sub nuw i8 [[START]], 4 -; CHECK-NEXT: [[F_4:%.*]] = icmp ugt i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_5:%.*]] = sub nuw i8 [[START]], 5 -; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[START_5]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: ret void ; @@ -192,13 +182,10 @@ ; CHECK-NEXT: [[F_2:%.*]] = icmp uge i8 [[START_2]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 [[F_2]]) ; CHECK-NEXT: [[START_3:%.*]] = sub nuw i8 [[START]], 3 -; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[START_3]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_4:%.*]] = sub nuw i8 [[START]], 4 -; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 [[START_4]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[START_5:%.*]] = sub nuw i8 [[START]], 5 -; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[START_5]], [[HIGH]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: ret void ; @@ -283,7 +270,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i16 [[A]], 0 ; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: exit.2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i16 [[A]], 0 ; CHECK-NEXT: ret i1 true ; entry: @@ -310,7 +296,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i64 [[A]], 0 ; CHECK-NEXT: ret i1 [[C_2]] ; CHECK: exit.2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i64 [[A]], 0 ; CHECK-NEXT: ret i1 true ; entry: @@ -334,7 +319,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i16 0, [[NEG2]] ; CHECK-NEXT: br i1 [[C_1]], label [[EXIT_1:%.*]], label [[EXIT_2:%.*]] ; CHECK: exit.1: -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i16 [[A]], 0 ; CHECK-NEXT: ret i1 false ; CHECK: exit.2: ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i16 [[A]], 0 diff --git a/llvm/test/Transforms/ConstraintElimination/switch.ll b/llvm/test/Transforms/ConstraintElimination/switch.ll --- a/llvm/test/Transforms/ConstraintElimination/switch.ll +++ b/llvm/test/Transforms/ConstraintElimination/switch.ll @@ -13,12 +13,10 @@ ; CHECK-NEXT: i32 1, label [[EXIT_2:%.*]] ; CHECK-NEXT: ] ; CHECK: exit.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i32 [[X]], 10 ; CHECK-NEXT: [[C_2:%.*]] = icmp ult i32 [[X]], 9 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: ret i1 [[RES_1]] ; CHECK: exit.2: -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i32 [[X]], 10 ; CHECK-NEXT: [[C_3:%.*]] = icmp ult i32 [[X]], 9 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 true, [[C_3]] ; CHECK-NEXT: ret i1 [[RES_2]] diff --git a/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll b/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll --- a/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll +++ b/llvm/test/Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned.ll @@ -9,8 +9,6 @@ ; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[IDX_POS]], [[IDX_SLT_LEN]] ; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i8 [[LEN]], 0 ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i8 [[LEN]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[LEN]], 2 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true @@ -48,8 +46,6 @@ ; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[IDX_SLT_LEN]], [[IDX_POS]] ; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i8 [[LEN]], 0 ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i8 [[LEN]], 2 ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[LEN]], 2 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true @@ -162,7 +158,6 @@ ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[CNT:%.*]], -1 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i32 [[CNT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -244,7 +239,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -273,7 +267,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -302,7 +295,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -331,7 +323,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -391,7 +382,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[GEP_EXT:%.*]] = getelementptr inbounds [[T:%.*]], ptr [[P:%.*]], i64 0, i32 1, i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp ugt ptr [[GEP_EXT]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -423,7 +413,6 @@ ; CHECK: check: ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[GEP_EXT:%.*]] = getelementptr inbounds [[T:%.*]], ptr [[P:%.*]], i64 0, i32 1, i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp ugt ptr [[GEP_EXT]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -458,7 +447,6 @@ ; CHECK: check: ; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[CNT]] to i64 ; CHECK-NEXT: [[GEP_EXT:%.*]] = getelementptr inbounds [[T:%.*]], ptr [[P:%.*]], i64 0, i32 1, i64 [[EXT]] -; CHECK-NEXT: [[CMP_1:%.*]] = icmp ugt ptr [[GEP_EXT]], [[P]] ; CHECK-NEXT: br i1 true, label [[THEN:%.*]], label [[ELSE]] ; CHECK: then: ; CHECK-NEXT: ret i1 false @@ -489,12 +477,9 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[IDX:%.*]], 2 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[IDX]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[IDX]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[IDX]], 3 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[IDX]], 2 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], false ; CHECK-NEXT: ret i1 [[RES_3]] ; @@ -555,7 +540,6 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[IDX:%.*]], -1 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[IDX]], 0 ; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[IDX]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[T_2]] ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[IDX]], -1 @@ -578,8 +562,6 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[IDX:%.*]], 2 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[IDX]], 2 -; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i8 [[IDX]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[IDX]], 3 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] @@ -601,7 +583,6 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], 2 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], 2 ; CHECK-NEXT: ret i1 true ; entry: @@ -616,7 +597,6 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[A:%.*]], 2 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], 1 ; CHECK-NEXT: ret i1 true ; entry: @@ -633,7 +613,6 @@ ; CHECK-NEXT: [[CMP_2:%.*]] = icmp sgt i8 [[B]], 0 ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_2]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[A]], [[B]] ; CHECK-NEXT: ret i1 true ; entry: @@ -714,8 +693,6 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 2, [[IDX:%.*]] ; CHECK-NEXT: call void @llvm.assume(i1 [[CMP]]) -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 2, [[IDX]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 1, [[IDX]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 3, [[IDX]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_1]] diff --git a/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll b/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll --- a/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll +++ b/llvm/test/Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed.ll @@ -9,12 +9,9 @@ ; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[LEN_POS]], [[IDX_ULT_LEN]] ; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i8 [[IDX]], 0 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i8 [[IDX]], 1 ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] -; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[LEN]], 1 ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], true ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: else: @@ -53,12 +50,9 @@ ; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[IDX_ULT_LEN]], [[LEN_POS]] ; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i8 [[IDX]], 0 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i8 [[IDX]], 1 ; CHECK-NEXT: [[R_2:%.*]] = xor i1 [[R_1]], [[C_1]] -; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[LEN]], 1 ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], true ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: else: @@ -98,7 +92,6 @@ ; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[LEN_POS]], [[IDX_ULT_LEN]] ; CHECK-NEXT: br i1 [[AND_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[IDX]], 0 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp sge i8 [[IDX]], 1 @@ -140,7 +133,6 @@ ; CHECK-NEXT: [[IDX_ULT_LEN:%.*]] = icmp ult i8 [[IDX:%.*]], [[LEN:%.*]] ; CHECK-NEXT: br i1 [[IDX_ULT_LEN]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: -; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[IDX]], [[LEN]] ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i8 [[IDX]], 0 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp sge i8 [[IDX]], 1 @@ -178,10 +170,7 @@ ; CHECK-NEXT: [[A_ULT_4:%.*]] = icmp ult i8 [[A:%.*]], 4 ; CHECK-NEXT: br i1 [[A_ULT_4]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: -; CHECK-NEXT: [[T_0:%.*]] = icmp sge i8 [[A]], 0 -; CHECK-NEXT: [[T_1:%.*]] = icmp slt i8 [[A]], 4 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[C_0:%.*]] = icmp slt i8 [[A]], 5 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true ; CHECK-NEXT: ret i1 [[RES_2]] ; CHECK: else: diff --git a/llvm/test/Transforms/ConstraintElimination/uge.ll b/llvm/test/Transforms/ConstraintElimination/uge.ll --- a/llvm/test/Transforms/ConstraintElimination/uge.ll +++ b/llvm/test/Transforms/ConstraintElimination/uge.ll @@ -9,7 +9,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -19,9 +18,7 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -62,9 +59,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -72,11 +67,8 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 11, [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1_1:%.*]] = icmp uge i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -124,7 +116,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[Z]] ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: ; CHECK-NEXT: ret i8 10 @@ -224,7 +215,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[U_1]]) diff --git a/llvm/test/Transforms/ConstraintElimination/ugt-ule.ll b/llvm/test/Transforms/ConstraintElimination/ugt-ule.ll --- a/llvm/test/Transforms/ConstraintElimination/ugt-ule.ll +++ b/llvm/test/Transforms/ConstraintElimination/ugt-ule.ll @@ -9,13 +9,11 @@ ; CHECK-NEXT: [[CMP_1:%.*]] = icmp ult ptr [[M:%.*]], [[PTR:%.*]] ; CHECK-NEXT: br i1 [[CMP_1]], label [[BB_1:%.*]], label [[BB_2:%.*]] ; CHECK: bb.1: -; CHECK-NEXT: [[CMP_2:%.*]] = icmp uge ptr [[M]], [[PTR]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: ret void ; CHECK: bb.2: ; CHECK-NEXT: br label [[BB_2_NEXT:%.*]] ; CHECK: bb.2.next: -; CHECK-NEXT: [[CMP_3:%.*]] = icmp uge ptr [[M]], [[PTR]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/ConstraintElimination/ule.ll b/llvm/test/Transforms/ConstraintElimination/ule.ll --- a/llvm/test/Transforms/ConstraintElimination/ule.ll +++ b/llvm/test/Transforms/ConstraintElimination/ule.ll @@ -9,7 +9,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -19,9 +18,7 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[Y]], [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], [[Y]] ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -62,9 +59,7 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp ule i8 [[X:%.*]], 10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -72,11 +67,8 @@ ; CHECK-NEXT: call void @use(i1 [[C_4]]) ; CHECK-NEXT: ret void ; CHECK: bb2: -; CHECK-NEXT: [[T_3:%.*]] = icmp ule i8 10, [[X]] ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ule i8 [[X]], 9 ; CHECK-NEXT: call void @use(i1 false) -; CHECK-NEXT: [[F_1_1:%.*]] = icmp ule i8 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_5:%.*]] = icmp ule i8 [[X]], 11 ; CHECK-NEXT: call void @use(i1 [[C_5]]) @@ -125,7 +117,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[C_3:%.*]] = icmp ule i8 [[X]], [[Z]] ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]] ; CHECK: bb3: ; CHECK-NEXT: ret i8 10 @@ -225,7 +216,6 @@ ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i8 [[Y]], [[Z:%.*]] ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]] ; CHECK: bb2: -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]] ; CHECK-NEXT: call void @use(i1 [[U_1]]) diff --git a/llvm/test/Transforms/ConstraintElimination/uses-in-different-blocks.ll b/llvm/test/Transforms/ConstraintElimination/uses-in-different-blocks.ll --- a/llvm/test/Transforms/ConstraintElimination/uses-in-different-blocks.ll +++ b/llvm/test/Transforms/ConstraintElimination/uses-in-different-blocks.ll @@ -5,7 +5,6 @@ ; CHECK-LABEL: @test_conds_single_use_in_different_blocks( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 5 ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 5 ; CHECK-NEXT: br i1 [[C_1]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: @@ -31,8 +30,7 @@ ; CHECK-LABEL: @test_conds_single_use_in_different_blocks_2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 -; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[Y:%.*]], 5 -; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[Y]], [[X]] +; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[Y:%.*]], [[X]] ; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[Y]], 5 ; CHECK-NEXT: br i1 [[C_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: @@ -70,7 +68,6 @@ ; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[Y:%.*]], 5 ; CHECK-NEXT: call void @llvm.assume(i1 [[T_1]]) ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[Y]], [[X]] -; CHECK-NEXT: [[C_3:%.*]] = icmp ugt i8 [[Y]], 5 ; CHECK-NEXT: br i1 [[C_1]], label [[THEN_1:%.*]], label [[ELSE:%.*]] ; CHECK: then.1: ; CHECK-NEXT: br i1 [[C_2]], label [[THEN_2:%.*]], label [[ELSE]] diff --git a/llvm/test/Transforms/ConstraintElimination/vector-compares.ll b/llvm/test/Transforms/ConstraintElimination/vector-compares.ll --- a/llvm/test/Transforms/ConstraintElimination/vector-compares.ll +++ b/llvm/test/Transforms/ConstraintElimination/vector-compares.ll @@ -13,9 +13,7 @@ ; CHECK-NEXT: br i1 [[C_1]], label [[LOOP:%.*]], label [[BB2]] ; CHECK: loop: ; CHECK-NEXT: [[IV:%.*]] = phi <4 x i8> [ zeroinitializer, [[PRE]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[T_1:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) -; CHECK-NEXT: [[F_1:%.*]] = icmp ugt i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 false) ; CHECK-NEXT: [[C_2:%.*]] = icmp ule i32 [[X]], 9 ; CHECK-NEXT: call void @use(i1 [[C_2]]) @@ -26,7 +24,6 @@ ; CHECK-NEXT: [[EC:%.*]] = icmp eq i8 [[E]], 100 ; CHECK-NEXT: br i1 [[EC]], label [[EXIT:%.*]], label [[LOOP]] ; CHECK: exit: -; CHECK-NEXT: [[C_4:%.*]] = icmp ule i32 [[X]], 10 ; CHECK-NEXT: call void @use(i1 true) ; CHECK-NEXT: ret void ; CHECK: bb2: diff --git a/llvm/test/Transforms/ConstraintElimination/wrapping-math.ll b/llvm/test/Transforms/ConstraintElimination/wrapping-math.ll --- a/llvm/test/Transforms/ConstraintElimination/wrapping-math.ll +++ b/llvm/test/Transforms/ConstraintElimination/wrapping-math.ll @@ -21,7 +21,6 @@ ; CHECK-NEXT: br i1 [[PRE]], label [[THEN:%.*]], label [[ELSE:%.*]] ; CHECK: then: ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[A]], -1 -; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[SUB_1]], 0 ; CHECK-NEXT: ret i1 true ; CHECK: else: ; CHECK-NEXT: [[SUB_2:%.*]] = add i8 [[A]], -1 @@ -82,7 +81,6 @@ ; CHECK-NEXT: br i1 [[OR]], label [[EXIT_1:%.*]], label [[IF_END:%.*]] ; CHECK: if.end: ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[B]], -1 -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[SUB_1]], [[A]] ; CHECK-NEXT: [[SUB_2:%.*]] = add i8 [[B]], -2 ; CHECK-NEXT: [[C_2:%.*]] = icmp ult i8 [[SUB_2]], [[A]] ; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 true, [[C_2]] @@ -131,10 +129,7 @@ ; CHECK-NEXT: [[ADD_1:%.*]] = add i8 [[A]], 1 ; CHECK-NEXT: br i1 [[AND]], label [[IF_END:%.*]], label [[EXIT_1:%.*]] ; CHECK: if.end: -; CHECK-NEXT: [[T_1:%.*]] = icmp ult i8 [[SUB_1]], [[B]] -; CHECK-NEXT: [[T_2:%.*]] = icmp ult i8 [[SUB_2]], [[B]] ; CHECK-NEXT: [[XOR_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[T_3:%.*]] = icmp ult i8 [[SUB_3]], [[B]] ; CHECK-NEXT: [[XOR_2:%.*]] = xor i1 [[XOR_1]], true ; CHECK-NEXT: [[C_1:%.*]] = icmp ult i8 [[SUB_4]], [[B]] ; CHECK-NEXT: [[XOR_3:%.*]] = xor i1 [[XOR_2]], [[C_1]] @@ -279,10 +274,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[A]], -1 ; CHECK-NEXT: [[ADD:%.*]] = add nuw i8 [[SUB_1]], 10 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[ADD]], 10 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[ADD]], 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[ADD]], 10 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false ; CHECK-NEXT: ret i1 [[RES_2]] ; @@ -306,10 +298,7 @@ ; CHECK-NEXT: call void @llvm.assume(i1 [[PRE]]) ; CHECK-NEXT: [[ADD:%.*]] = add nuw i8 [[A]], 10 ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[ADD]], -1 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[SUB_1]], 10 -; CHECK-NEXT: [[T_2:%.*]] = icmp ule i8 [[SUB_1]], 10 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, true -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i8 [[SUB_1]], 10 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false ; CHECK-NEXT: ret i1 [[RES_2]] ; diff --git a/llvm/test/Transforms/ConstraintElimination/zext-for-per-formula-reasoning.ll b/llvm/test/Transforms/ConstraintElimination/zext-for-per-formula-reasoning.ll --- a/llvm/test/Transforms/ConstraintElimination/zext-for-per-formula-reasoning.ll +++ b/llvm/test/Transforms/ConstraintElimination/zext-for-per-formula-reasoning.ll @@ -9,7 +9,6 @@ ; CHECK-NEXT: [[CMP_0:%.*]] = icmp uge i8 [[ADD]], 10 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[X]] to i16 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[EXT]], 0 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[EXT]], 1 ; CHECK-NEXT: [[RES:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: ret i1 [[RES]] @@ -31,9 +30,7 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP_0]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[X]] to i16 ; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i16 [[EXT]], 1 -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[ADD_1]], 1 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[ADD_1]], 2 -; CHECK-NEXT: [[F_1:%.*]] = icmp ult i16 [[ADD_1]], 1 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]] ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], false ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i16 [[ADD_1]], 1 @@ -63,8 +60,6 @@ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]]) ; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[CNT]] to i16 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[P:%.*]], i16 [[EXT]] -; CHECK-NEXT: [[T_1:%.*]] = icmp uge ptr [[ADD_PTR]], [[P]] -; CHECK-NEXT: [[F_1:%.*]] = icmp ult ptr [[ADD_PTR]], [[P]] ; CHECK-NEXT: [[GEP_11:%.*]] = getelementptr inbounds i32, ptr [[P]], i16 11 ; CHECK-NEXT: [[C_1:%.*]] = icmp ugt ptr [[ADD_PTR]], [[GEP_11]] ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false diff --git a/llvm/test/Transforms/ConstraintElimination/zext.ll b/llvm/test/Transforms/ConstraintElimination/zext.ll --- a/llvm/test/Transforms/ConstraintElimination/zext.ll +++ b/llvm/test/Transforms/ConstraintElimination/zext.ll @@ -8,7 +8,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] @@ -17,8 +16,6 @@ ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -60,7 +57,6 @@ ; CHECK-NEXT: [[Y_EXT:%.*]] = zext i8 [[Y]] to i16 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y_EXT]] ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp sge i16 [[Y_EXT]], [[X_EXT]] @@ -69,8 +65,6 @@ ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y_EXT]], [[X_EXT]] -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y_EXT]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -123,8 +117,6 @@ ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp uge i16 [[Y]], [[X_EXT]] -; CHECK-NEXT: [[F_1:%.*]] = icmp uge i16 [[X_EXT]], [[Y]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -167,7 +159,6 @@ ; CHECK-NEXT: [[C_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y:%.*]] ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]] ; CHECK: bb1: -; CHECK-NEXT: [[T_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y]] ; CHECK-NEXT: [[C_2:%.*]] = icmp sge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, [[C_2]] ; CHECK-NEXT: [[C_3:%.*]] = icmp sge i16 [[Y]], [[X_EXT]] @@ -176,8 +167,6 @@ ; CHECK-NEXT: [[R_3:%.*]] = xor i1 [[R_2]], [[C_4]] ; CHECK-NEXT: ret i1 [[R_3]] ; CHECK: bb2: -; CHECK-NEXT: [[T_2:%.*]] = icmp sge i16 [[Y]], [[X_EXT]] -; CHECK-NEXT: [[F_1:%.*]] = icmp sge i16 [[X_EXT]], [[Y]] ; CHECK-NEXT: [[R_4:%.*]] = xor i1 true, false ; CHECK-NEXT: [[C_5:%.*]] = icmp sge i16 [[X_EXT]], 10 ; CHECK-NEXT: [[R_5:%.*]] = xor i1 [[R_4]], [[C_5]] @@ -266,6 +255,21 @@ } define i1 @test_pr58009_const_zext() { +; CHECK-LABEL: @test_pr58009_const_zext( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[EXT_T_1:%.*]] = zext i1 true to i16 +; CHECK-NEXT: [[EXT_T_2:%.*]] = zext i1 true to i16 +; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, false +; CHECK-NEXT: [[EXT_F_1:%.*]] = zext i1 false to i16 +; CHECK-NEXT: [[EXT_F_2:%.*]] = zext i1 false to i16 +; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], true +; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], false +; CHECK-NEXT: [[T_3:%.*]] = icmp ult i16 [[EXT_F_1]], [[EXT_T_2]] +; CHECK-NEXT: [[F_3:%.*]] = icmp ugt i16 [[EXT_F_1]], [[EXT_T_2]] +; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[T_3]] +; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], [[F_3]] +; CHECK-NEXT: ret i1 [[RES_5]] +; entry: %ext.t.1 = zext i1 true to i16 %ext.t.2 = zext i1 true to i16