Skip to content

Commit 6b70d5d

Browse files
authored
Merge pull request #13849 from adrian-prantl/36392957-4.1
Cherry-pick fix for rdar://36392957 4.1
2 parents 4078350 + 6ab9bca commit 6b70d5d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ struct StructLoweringState {
385385
SmallVector<SILInstruction *, 16> destroyValueInstsToMod;
386386
// All debug instructions.
387387
// to be modified *only if* the operands are used in "real" instructions
388-
SmallVector<SILInstruction *, 16> debugInstsToMod;
388+
SmallVector<DebugValueInst *, 16> debugInstsToMod;
389389

390390
StructLoweringState(SILFunction *F, irgen::IRGenModule &Mod)
391391
: F(F), Mod(Mod) {}
@@ -1860,7 +1860,7 @@ static void rewriteFunction(StructLoweringState &pass,
18601860
instr->getParent()->erase(instr);
18611861
}
18621862

1863-
for (SILInstruction *instr : pass.debugInstsToMod) {
1863+
for (DebugValueInst *instr : pass.debugInstsToMod) {
18641864
assert(instr->getAllOperands().size() == 1 &&
18651865
"Debug instructions have one operand");
18661866
for (Operand &operand : instr->getAllOperands()) {
@@ -1875,7 +1875,8 @@ static void rewriteFunction(StructLoweringState &pass,
18751875
assert(currOperand->getType().isAddress() &&
18761876
"Expected an address type");
18771877
SILBuilderWithScope debugBuilder(instr);
1878-
debugBuilder.createDebugValueAddr(instr->getLoc(), currOperand);
1878+
debugBuilder.createDebugValueAddr(instr->getLoc(), currOperand,
1879+
instr->getVarInfo());
18791880
instr->getParent()->erase(instr);
18801881
}
18811882
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
2+
3+
public struct Large {
4+
let field1 : Int64 = 1
5+
let field2 : Int64 = 2
6+
let field3 : Int64 = 3
7+
let field4 : Int64 = 4
8+
let field5 : Int64 = 5
9+
let field6 : Int64 = 6
10+
let field7 : Int64 = 7
11+
let field8 : Int64 = 8
12+
}
13+
14+
// CHECK: !DILocalVariable(name: "largeArg", arg: 1
15+
public func f(_ largeArg : Large) {}

0 commit comments

Comments
 (0)