Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp =================================================================== --- llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -877,12 +877,7 @@ unsigned OperandNo = 0; for (auto CI = Call->data_operands_begin(), CE = Call->data_operands_end(); CI != CE; ++CI, ++OperandNo) { - // Only look at the no-capture or byval pointer arguments. If this - // pointer were passed to arguments that were neither of these, then it - // couldn't be no-capture. - if (!(*CI)->getType()->isPointerTy() || - (!Call->doesNotCapture(OperandNo) && OperandNo < Call->arg_size() && - !Call->isByValArgument(OperandNo))) + if (!(*CI)->getType()->isPointerTy()) continue; // Call doesn't access memory through this operand, so we don't care Index: llvm/test/Transforms/PhaseOrdering/dse-ephemeral-value-captures.ll =================================================================== --- llvm/test/Transforms/PhaseOrdering/dse-ephemeral-value-captures.ll +++ llvm/test/Transforms/PhaseOrdering/dse-ephemeral-value-captures.ll @@ -26,7 +26,13 @@ define i32 @test() { ; CHECK-LABEL: define i32 @test() { ; CHECK-NEXT: entry: -; CHECK-NEXT: unreachable +; CHECK-NEXT: br label [[THEN_I:%.*]] +; CHECK: then.i: +; CHECK-NEXT: [[RES_I:%.*]] = call i1 @cond() +; CHECK-NEXT: br label [[CHECK_COND_EXIT:%.*]] +; CHECK: check_cond.exit: +; CHECK-NEXT: call void @llvm.assume(i1 [[RES_I]]) +; CHECK-NEXT: ret i32 0 ; entry: %a = alloca i32, align 4