Skip to content

Commit d3f8c1e

Browse files
committed
Fix a logic error that would cause shadow copies to be emitted at -O.
<rdar://problem/27206870>
1 parent d03babd commit d3f8c1e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,12 @@ class IRGenSILFunction :
626626
StringRef Name, unsigned ArgNo,
627627
Alignment Align = Alignment(0)) {
628628
auto Ty = Storage->getType();
629-
if (IGM.IRGen.Opts.Optimize || (ArgNo == 0) ||
629+
if (IGM.IRGen.Opts.Optimize ||
630630
isa<llvm::AllocaInst>(Storage) ||
631631
isa<llvm::UndefValue>(Storage) ||
632-
Ty == IGM.RefCountedPtrTy) { // No debug info is emitted for refcounts.
632+
Ty == IGM.RefCountedPtrTy) // No debug info is emitted for refcounts.
633+
return Storage;
634+
if (ArgNo == 0) {
633635
// Account for bugs in LLVM.
634636
//
635637
// - The LLVM type legalizer currently doesn't update debug

test/DebugInfo/local-vars.swift.gyb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
// RUN: %target-swift-frontend %t.swift -g -c -o %t.o
88
// RUN: llvm-dwarfdump --debug-dump=info %t.o \
99
// RUN: | FileCheck %t.swift --check-prefix=DWARF
10+
// RUN: %target-swift-frontend %t.swift -O -g -emit-ir -o - \
11+
// RUN: | FileCheck %t.swift --check-prefix=OPTZNS
12+
13+
// OPTZNS-NOT: alloca{{.*}}.addr
1014

1115
public class C {
1216
let member : Int

0 commit comments

Comments
 (0)