diff --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp --- a/llvm/lib/Analysis/StackLifetime.cpp +++ b/llvm/lib/Analysis/StackLifetime.cpp @@ -257,14 +257,12 @@ unsigned AllocaNo = It.second.AllocaNo; if (IsStart) { - assert(!Started.test(AllocaNo) || Start[AllocaNo] == BBStart); if (!Started.test(AllocaNo)) { Started.set(AllocaNo); Ended.reset(AllocaNo); Start[AllocaNo] = InstNo; } } else { - assert(!Ended.test(AllocaNo)); if (Started.test(AllocaNo)) { LiveRanges[AllocaNo].addRange(Start[AllocaNo], InstNo); Started.reset(AllocaNo); diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll --- a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll +++ b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll @@ -179,6 +179,20 @@ ret i32 0 } +define dso_local i32 @multiple_start_end() local_unnamed_addr sanitize_hwaddress { +; SCOPE-LABEL: @multiple_start_end( +; SCOPE: call void @__hwasan_tag_memory +; SCOPE: call void @use +; SCOPE: call void @__hwasan_tag_memory + %1 = alloca i8, align 1 + call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %1) + call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %1) + call void @use(i8* nonnull %1) + call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %1) + call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %1) + ret i32 0 +} + declare dso_local i1 @cond(...) local_unnamed_addr declare dso_local void @use(i8*) local_unnamed_addr