Skip to content

Commit 33f04dc

Browse files
author
ematejska
authored
Merge pull request #4382 from adrian-prantl/27891980-3.0
Debug Info: Handle vector types when extending variable live ranges.
2 parents 06fd4ad + 21a5923 commit 33f04dc

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,14 @@ class IRGenSILFunction :
594594
if (getActiveDominancePoint() == VarDominancePoint ||
595595
isActiveDominancePointDominatedBy(VarDominancePoint)) {
596596
llvm::Type *ArgTys;
597-
auto *Ty = Storage->getType()->getScalarType();
598-
// Pointers and Floats are expected to fit into a register.
599-
if (Ty->isPointerTy() || Ty->isFloatingPointTy())
600-
ArgTys = { Storage->getType() };
597+
auto *Ty = Storage->getType();
598+
// Vectors, Pointers and Floats are expected to fit into a register.
599+
if (Ty->isPointerTy() || Ty->isFloatingPointTy() || Ty->isVectorTy())
600+
ArgTys = { Ty };
601601
else {
602+
// If this is not a scalar or vector type, we can't handle it.
603+
if (isa<llvm::CompositeType>(Ty))
604+
continue;
602605
// The storage is guaranteed to be no larger than the register width.
603606
// Extend the storage so it would fit into a register.
604607
llvm::Type *IntTy;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
2+
// REQUIRES: objc_interop, CPU=x86_64
3+
import simd
4+
5+
func use<T>(_ x: T) {}
6+
7+
func getInt32() -> Int32 { return -1 }
8+
9+
public func rangeExtension(x: Int32, y: Int32) {
10+
let p = int2(x, y)
11+
// CHECK: define {{.*}}rangeExtension
12+
// CHECK: llvm.dbg.value(metadata <2 x i32> %[[P:.*]], i64 0, metadata
13+
use(p)
14+
// CHECK: asm sideeffect "", "r"{{.*}}[[P]]
15+
}

0 commit comments

Comments
 (0)