diff --git a/lib/Analysis/CaptureTracking.cpp b/lib/Analysis/CaptureTracking.cpp index e14f6f25dc1..25815fc5746 100644 --- a/lib/Analysis/CaptureTracking.cpp +++ b/lib/Analysis/CaptureTracking.cpp @@ -143,14 +143,8 @@ namespace { return !isPotentiallyReachableFromMany(Worklist, BB, nullptr, DT); } - // If the value is defined in the same basic block as use and BeforeHere, - // there is no need to explore the use if BeforeHere dominates use. // Check whether there is a path from I to BeforeHere. - if (DT->dominates(BeforeHere, I) && - !isPotentiallyReachable(I, BeforeHere, nullptr, DT)) - return true; - - return false; + return !isPotentiallyReachable(I, BeforeHere, nullptr, DT); } bool captured(const Use *U) override { diff --git a/test/Transforms/MemCpyOpt/callslot.ll b/test/Transforms/MemCpyOpt/callslot.ll index 037a95ec517..b9eab2ef877 100644 --- a/test/Transforms/MemCpyOpt/callslot.ll +++ b/test/Transforms/MemCpyOpt/callslot.ll @@ -252,8 +252,8 @@ define void @capture_nopath_call(i1 %cond) { ; CHECK-NEXT: call void @accept_ptr(i8* [[DEST_I8]]) ; CHECK-NEXT: ret void ; CHECK: nocaptures: -; CHECK-NEXT: call void @accept_ptr(i8* [[SRC_I8]]) #[[ATTR3]] -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[DEST_I8]], i8* [[SRC_I8]], i64 16, i1 false) +; CHECK-NEXT: [[DEST1:%.*]] = bitcast [16 x i8]* [[DEST]] to i8* +; CHECK-NEXT: call void @accept_ptr(i8* [[DEST1]]) #[[ATTR3]] ; CHECK-NEXT: ret void ; %dest = alloca [16 x i8]