]> granicus.if.org Git - clang/commitdiff
Do not use IR marker for LLVM intrinsics
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2011 12:29:09 +0000 (12:29 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 6 Apr 2011 12:29:09 +0000 (12:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129001 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ItaniumMangle.cpp
test/CodeGen/mangle.c

index bb274a96f1c262c44571c1a0334b62c30e20af34..6ab68dbae92586d96cc4a4d6f7d58b3d8e056bf2 100644 (file)
@@ -334,10 +334,11 @@ void CXXNameMangler::mangle(const NamedDecl *D, llvm::StringRef Prefix) {
     // another has a "\01foo". That is known to happen on ELF with the
     // tricks normally used for producing aliases (PR9177). Fortunately the
     // llvm mangler on ELF is a nop, so we can just avoid adding the \01
-    // marker.
+    // marker.  We also avoid adding the marker if this is an alias for an
+    // LLVM intrinsic.
     llvm::StringRef UserLabelPrefix =
       getASTContext().Target.getUserLabelPrefix();
-    if (!UserLabelPrefix.empty())
+    if (!UserLabelPrefix.empty() && !ALA->getLabel().startswith("llvm."))
       Out << '\01';  // LLVM IR Marker for __asm("foo")
 
     Out << ALA->getLabel();
index 3bbd9c8b807ea3557204c007631e34e2170370f6..46ef512f695001c8788866b15d6135785cd5edf9 100644 (file)
@@ -63,3 +63,12 @@ int func(void) {
 // CHECK: @_Z4foo9Dv4_f
 typedef __attribute__(( vector_size(16) )) float float4;
 void __attribute__((__overloadable__)) foo9(float4 f) {}
+
+// Intrinsic calls.
+extern int llvm_cas(volatile int*, int, int)
+  __asm__("llvm.atomic.cmp.swap.i32.p0i32");
+
+int foo10(volatile int* add, int from, int to) {
+  // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32
+  return llvm_cas(add, from, to);
+}