[PATCH] D58509: [CodeGen] Fix string literal address space casting.
Michael Liao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 21 11:43:33 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC354610: [CodeGen] Fix string literal address space casting. (authored by hliao, committed by ).
Herald added a subscriber: ebevhan.
Changed prior to commit:
https://reviews.llvm.org/D58509?vs=187797&id=187834#toc
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58509/new/
https://reviews.llvm.org/D58509
Files:
lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/amdgcn-string-literal.cpp
Index: test/CodeGenCXX/amdgcn-string-literal.cpp
===================================================================
--- test/CodeGenCXX/amdgcn-string-literal.cpp
+++ test/CodeGenCXX/amdgcn-string-literal.cpp
@@ -14,7 +14,7 @@
// CHECK-LABEL: define void @_Z1fv()
void f() {
const char* l_str = "l_str";
-
+
// CHECK: call void @llvm.memcpy.p0i8.p4i8.i64
char l_array[] = "l_array";
@@ -26,3 +26,9 @@
const char* p = g_str;
g(p);
}
+
+// CHECK-LABEL: define void @_Z1ev
+void e() {
+ g("string literal");
+ g("string literal");
+}
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -4522,7 +4522,8 @@
if (auto GV = *Entry) {
if (Alignment.getQuantity() > GV->getAlignment())
GV->setAlignment(Alignment.getQuantity());
- return ConstantAddress(GV, Alignment);
+ return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV),
+ Alignment);
}
}
@@ -4584,7 +4585,8 @@
if (auto GV = *Entry) {
if (Alignment.getQuantity() > GV->getAlignment())
GV->setAlignment(Alignment.getQuantity());
- return ConstantAddress(GV, Alignment);
+ return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV),
+ Alignment);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58509.187834.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190221/5d6698fc/attachment.bin>
More information about the cfe-commits
mailing list