Skip to content

Commit 8c37fc4

Browse files
author
git apple-llvm automerger
committed
Merge commit '0fbb794a3709' from swift/release/5.5 into swift/main
2 parents c61278c + 0fbb794 commit 8c37fc4

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
SWIFT_SOURCES := main.swift
2-
3-
include Makefile.rules
1+
all:
2+
$(MAKE) -C "pro:ject"

lldb/test/API/lang/swift/path_with_colons/TestSwiftPathWithColons.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def do_test(self):
4545
copied_src = os.path.join(colon_dir, 'main.swift')
4646
dst = os.path.join(colon_dir, 'a.out')
4747
dst_makefile = os.path.join(colon_dir, 'Makefile')
48+
exe = os.path.join(colon_dir, 'a.out')
4849

4950
if not os.path.exists(colon_dir):
5051
os.makedirs(colon_dir)
@@ -53,26 +54,23 @@ def do_test(self):
5354
# clean slate for the next test case.
5455
def cleanup():
5556
shutil.rmtree(colon_dir)
56-
os.chdir(self.getSourceDir())
5757

5858
# Execute the cleanup function during test case tear down.
5959
self.addTearDownHook(cleanup)
6060

6161
f = open(dst_makefile, 'w')
6262
f.write('''
63-
LEVEL = ../../../../make
6463
SWIFT_SOURCES := main.swift
65-
include $(LEVEL)/Makefile.rules
64+
include Makefile.rules
6665
''')
6766
f.close()
6867

6968
shutil.copy(src, copied_src)
7069

71-
os.chdir(colon_dir)
7270
self.build()
7371

7472
# Create the target
75-
target = self.dbg.CreateTarget(self.getBuildArtifact())
73+
target = self.dbg.CreateTarget(exe)
7674
self.assertTrue(target, VALID_TARGET)
7775

7876
# Don't allow ansi highlighting to interfere with the output.

llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "llvm/ADT/SmallVector.h"
2727
#include "llvm/ADT/StringRef.h"
2828
#include "llvm/ADT/Twine.h"
29+
#include "llvm/Analysis/CFG.h"
2930
#include "llvm/Analysis/CallGraph.h"
3031
#include "llvm/Analysis/CallGraphSCCPass.h"
3132
#include "llvm/Analysis/LazyCallGraph.h"
@@ -37,6 +38,7 @@
3738
#include "llvm/IR/Constants.h"
3839
#include "llvm/IR/DataLayout.h"
3940
#include "llvm/IR/DerivedTypes.h"
41+
#include "llvm/IR/Dominators.h"
4042
#include "llvm/IR/Function.h"
4143
#include "llvm/IR/GlobalValue.h"
4244
#include "llvm/IR/GlobalVariable.h"
@@ -659,8 +661,10 @@ static void salvageCoroDebugInfo(llvm::Function &NewF) {
659661

660662
// Remove all salvaged dbg.declare intrinsics that became
661663
// either unreachable or stale due to the CoroSplit transformation.
664+
DominatorTree DomTree(NewF);
665+
SmallDenseMap<BasicBlock *, bool, 8> UnreachableCache;
662666
auto IsUnreachableBlock = [&](BasicBlock *BB) {
663-
return BB->hasNPredecessors(0) && BB != &NewF.getEntryBlock();
667+
return !isPotentiallyReachable(&NewF.getEntryBlock(), BB, &DomTree);
664668
};
665669
for (DbgDeclareInst *DDI : Worklist) {
666670
if (IsUnreachableBlock(DDI->getParent()))

llvm/test/Transforms/Coroutines/coro-debug.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ entry:
2020
store i8* %2, i8** %coro_hdl, align 8, !dbg !16
2121
%3 = call i8 @llvm.coro.suspend(token none, i1 false), !dbg !17
2222
%conv = sext i8 %3 to i32, !dbg !17
23+
%late_local = alloca i32, align 4
2324
call void @coro.devirt.trigger(i8* null)
2425
switch i32 %conv, label %sw.default [
2526
i32 0, label %sw.bb
@@ -57,6 +58,7 @@ coro_Cleanup: ; preds = %sw.epilog, %sw.bb1
5758
coro_Suspend: ; preds = %coro_Cleanup, %sw.default
5859
%7 = call i1 @llvm.coro.end(i8* null, i1 false) #7, !dbg !24
5960
%8 = load i8*, i8** %coro_hdl, align 8, !dbg !24
61+
store i32 0, i32* %late_local, !dbg !24
6062
ret i8* %8, !dbg !24
6163
}
6264

@@ -147,6 +149,8 @@ attributes #7 = { noduplicate }
147149
; CHECK: store %f.Frame* {{.*}}, %f.Frame** %[[DBG_PTR]]
148150
; CHECK-NOT: alloca %struct.test*
149151
; CHECK: call void @llvm.dbg.declare(metadata i32 0, metadata ![[RESUME_CONST:[0-9]+]], metadata !DIExpression())
152+
; Note that keeping the undef value here could be acceptable, too.
153+
; CHECK-NOT: call void @llvm.dbg.declare(metadata i32* undef, metadata !{{[0-9]+}}, metadata !DIExpression())
150154
; CHECK: call void @coro.devirt.trigger(i8* null)
151155
; CHECK: define internal fastcc void @f.destroy(%f.Frame* noalias nonnull align 8 dereferenceable(32) %FramePtr) #0 !dbg ![[DESTROY:[0-9]+]]
152156
; CHECK: define internal fastcc void @f.cleanup(%f.Frame* noalias nonnull align 8 dereferenceable(32) %FramePtr) #0 !dbg ![[CLEANUP:[0-9]+]]

0 commit comments

Comments
 (0)