[CodeGen] Fix string literal address space casting.
Summary:
- If a string literal is reused directly, need to add necessary address
space casting if the target requires that.
Reviewers: yaxunl
Subscribers: jvesely, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58509
llvm-svn: 354610
diff --git a/clang/test/CodeGenCXX/amdgcn-string-literal.cpp b/clang/test/CodeGenCXX/amdgcn-string-literal.cpp
index 70be249..3148077 100644
--- a/clang/test/CodeGenCXX/amdgcn-string-literal.cpp
+++ b/clang/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");
+}