Skip to content

[global-string-table] Fix for ownership. #27484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/SILOptimizer/Utils/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "swift/SIL/SILBuilder.h"
#include "swift/SILOptimizer/Utils/CastOptimizer.h"
#include "swift/SILOptimizer/Utils/Local.h"
#include "swift/SIL/InstructionUtils.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/Statistic.h"
Expand Down Expand Up @@ -1527,7 +1528,11 @@ static bool
constantFoldGlobalStringTablePointerBuiltin(BuiltinInst *bi,
bool enableDiagnostics) {
// Look through string initializer to extract the string_literal instruction.
SILValue builtinOperand = bi->getOperand(0);
//
// We allow for a single borrow to be stripped here if we are here in
// [ossa]. The begin borrow occurs b/c SILGen treats builtins as having
// arguments with a +0 convention (implying a borrow).
SILValue builtinOperand = stripBorrow(bi->getOperand(0));
SILFunction *caller = bi->getFunction();

FullApplySite stringInitSite = FullApplySite::isa(builtinOperand);
Expand Down
1 change: 1 addition & 0 deletions test/SILOptimizer/diagnostic_constant_propagation.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %target-swift-frontend -emit-sil -primary-file %s -o /dev/null -verify
// RUN: %target-swift-frontend -emit-sil -enable-ownership-stripping-after-serialization -primary-file %s -o /dev/null -verify
//
// These are tests for diagnostics produced by constant propagation pass.
// Due to the change in the implementation of Integer initializers some of the
Expand Down