Skip to content

Commit 133901d

Browse files
committed
[irgen] Emit shadow copies for ConstantDataVector.
LLVM seems to not support this today. With ownership SSA, we now produce these for accelerate for some reason, causing lldb/TestAccelerateSIMD.py to fail. I debugged this with Adrian and we got this fix. I filed the radar below against Adrian to fix. rdar://74287800
1 parent ff3c7ba commit 133901d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717

18-
#include "llvm/IR/Constant.h"
1918
#define DEBUG_TYPE "irgensil"
19+
2020
#include "swift/AST/ASTContext.h"
2121
#include "swift/AST/IRGenOptions.h"
2222
#include "swift/AST/ParameterList.h"
@@ -47,6 +47,8 @@
4747
#include "llvm/ADT/MapVector.h"
4848
#include "llvm/ADT/SmallBitVector.h"
4949
#include "llvm/ADT/TinyPtrVector.h"
50+
#include "llvm/IR/Constant.h"
51+
#include "llvm/IR/Constants.h"
5052
#include "llvm/IR/DIBuilder.h"
5153
#include "llvm/IR/Function.h"
5254
#include "llvm/IR/InlineAsm.h"
@@ -700,6 +702,10 @@ class IRGenSILFunction :
700702
///
701703
/// - CodeGen Prepare may drop dbg.values pointing to PHI instruction.
702704
bool needsShadowCopy(llvm::Value *Storage) {
705+
// If we have a constant data vector, we always need a shadow copy due to
706+
// bugs in LLVM.
707+
if (isa<llvm::ConstantDataVector>(Storage))
708+
return true;
703709
return !isa<llvm::Constant>(Storage);
704710
}
705711

0 commit comments

Comments
 (0)