Index: llvm/lib/Analysis/LazyValueInfo.cpp =================================================================== --- llvm/lib/Analysis/LazyValueInfo.cpp +++ llvm/lib/Analysis/LazyValueInfo.cpp @@ -470,11 +470,6 @@ ValueLatticeElement getValueInBlock(Value *V, BasicBlock *BB, Instruction *CxtI = nullptr); - /// This is the query interface to determine the lattice - /// value for the specified Value* at the specified instruction (generally - /// from an assume intrinsic). - ValueLatticeElement getValueAt(Value *V, Instruction *CxtI); - /// This is the query interface to determine the lattice /// value for the specified Value* that is true on the specified edge. ValueLatticeElement getValueOnEdge(Value *V, BasicBlock *FromBB, @@ -1573,22 +1568,6 @@ return Result; } -ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CxtI) { - LLVM_DEBUG(dbgs() << "LVI Getting value " << *V << " at '" << CxtI->getName() - << "'\n"); - - if (auto *C = dyn_cast(V)) - return ValueLatticeElement::get(C); - - ValueLatticeElement Result = ValueLatticeElement::getOverdefined(); - if (auto *I = dyn_cast(V)) - Result = getFromRangeMetadata(I); - intersectAssumeOrGuardBlockValueConstantRange(V, Result, CxtI); - - LLVM_DEBUG(dbgs() << " Result = " << Result << "\n"); - return Result; -} - ValueLatticeElement LazyValueInfoImpl:: getValueOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI) { @@ -1869,7 +1848,9 @@ else if (Pred == ICmpInst::ICMP_NE) return LazyValueInfo::True; } - ValueLatticeElement Result = getImpl(PImpl, AC, &DL, DT).getValueAt(V, CxtI); + + ValueLatticeElement Result = + getImpl(PImpl, AC, &DL, DT).getValueInBlock(V, CxtI->getParent(), CxtI); Tristate Ret = getPredicateResult(Pred, C, Result, DL, TLI); if (Ret != Unknown) return Ret; Index: llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll =================================================================== --- llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll +++ llvm/test/Analysis/LazyValueAnalysis/lvi-after-jumpthreading.ll @@ -18,11 +18,11 @@ ; CHECK-LABEL: backedge: ; CHECK-NEXT: ; LatticeVal for: 'i32 %a' is: overdefined ; CHECK-NEXT: ; LatticeVal for: 'i32 %length' is: overdefined -; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%backedge' is: constantrange<0, 400> -; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%exit' is: constantrange<399, 400> +; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%backedge' is: constantrange<0, -2147483648> +; CHECK-NEXT: ; LatticeVal for: ' %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]' in BB: '%exit' is: constantrange<399, 2147483647> ; CHECK-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ] -; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%backedge' is: constantrange<1, 401> -; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%exit' is: constantrange<400, 401> +; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%backedge' is: constantrange<1, -2147483648> +; CHECK-NEXT: ; LatticeVal for: ' %iv.next = add nsw i32 %iv, 1' in BB: '%exit' is: constantrange<400, -2147483648> ; CHECK-NEXT: %iv.next = add nsw i32 %iv, 1 ; CHECK-NEXT: ; LatticeVal for: ' %cont = icmp slt i32 %iv.next, 400' in BB: '%backedge' is: overdefined ; CHECK-NEXT: ; LatticeVal for: ' %cont = icmp slt i32 %iv.next, 400' in BB: '%exit' is: constantrange<0, -1> Index: llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll =================================================================== --- llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll +++ llvm/test/Transforms/CorrelatedValuePropagation/icmp.ll @@ -381,7 +381,7 @@ ; CHECK-NEXT: [[SHR:%.*]] = lshr i64 [[MUL]], 32 ; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[SHR]] to i32 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[TRUNC]], 7 -; CHECK-NEXT: ret i1 [[CMP]] +; CHECK-NEXT: ret i1 true ; %zext = zext i32 %x to i64 %mul = mul nuw i64 %zext, 7 @@ -397,7 +397,7 @@ ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[ZEXT]], 128 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[ADD]], 384 ; CHECK-NEXT: store i64 [[ADD]], i64* [[P:%.*]] -; CHECK-NEXT: ret i1 [[CMP]] +; CHECK-NEXT: ret i1 true ; %zext = zext i8 %x to i64 %add = add nuw nsw i64 %zext, 128 Index: llvm/test/Transforms/JumpThreading/bb-unreachable-from-entry.ll =================================================================== --- llvm/test/Transforms/JumpThreading/bb-unreachable-from-entry.ll +++ llvm/test/Transforms/JumpThreading/bb-unreachable-from-entry.ll @@ -3,7 +3,12 @@ define void @foo() { ; CHECK-LABEL: @foo( -; CHECK-NEXT: exit2: +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[EXIT2:%.*]] +; CHECK: entry2: +; CHECK-NEXT: br label [[EXIT2]] +; CHECK: exit2: +; CHECK-NEXT: [[A0:%.*]] = phi i32 [ undef, [[ENTRY2:%.*]] ], [ 0, [[ENTRY:%.*]] ] ; CHECK-NEXT: ret void ; entry: Index: llvm/test/Transforms/JumpThreading/header-succ.ll =================================================================== --- llvm/test/Transforms/JumpThreading/header-succ.ll +++ llvm/test/Transforms/JumpThreading/header-succ.ll @@ -103,12 +103,13 @@ ; CHECK-NEXT: [[IND:%.*]] = phi i32 [ 0, [[TOP:%.*]] ], [ [[NEXTIND:%.*]], [[LATCH:%.*]] ] ; CHECK-NEXT: [[NEXTIND]] = add i32 [[IND]], 1 ; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[IND]], 10 -; CHECK-NEXT: br i1 [[CMP]], label [[LATCH]], label [[EXIT:%.*]] -; CHECK: latch: +; CHECK-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[LATCH]] +; CHECK: body: ; CHECK-NEXT: call void @opaque_body() +; CHECK-NEXT: br label [[LATCH]] +; CHECK: latch: +; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ undef, [[ENTRY]] ], [ 0, [[BODY]] ] ; CHECK-NEXT: br label [[ENTRY]] -; CHECK: exit: -; CHECK-NEXT: ret void ; top: br label %entry