From 6e40e1d15c70d21b582dc8273f727aadc751a380 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 5 Apr 2004 20:17:53 +0000 Subject: [PATCH] Do not mangle intrinsics in any way! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12673 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Mangler.cpp | 5 ++++- lib/VMCore/Mangler.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Support/Mangler.cpp b/lib/Support/Mangler.cpp index 0982efd8cd9..0705c9b608c 100644 --- a/lib/Support/Mangler.cpp +++ b/lib/Support/Mangler.cpp @@ -56,13 +56,16 @@ std::string Mangler::getValueName(const Value *V) { std::string name; if (V->hasName()) { // Print out the label if it exists... // Name mangling occurs as follows: + // - If V is an intrinsic function, do not change name at all // - If V is not a global, mangling always occurs. // - Otherwise, mangling occurs when any of the following are true: // 1) V has internal linkage // 2) V's name would collide if it is not mangled. // const GlobalValue* gv = dyn_cast(V); - if (gv && !gv->hasInternalLinkage() && !MangledGlobals.count(gv)) { + if (gv && isa(gv) && cast(gv)->getIntrinsicID()) { + name = gv->getName(); // Is an intrinsic function + } else if (gv && !gv->hasInternalLinkage() && !MangledGlobals.count(gv)) { name = makeNameProper(gv->getName()); if (AddUnderscorePrefix) name = "_" + name; } else { diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp index 0982efd8cd9..0705c9b608c 100644 --- a/lib/VMCore/Mangler.cpp +++ b/lib/VMCore/Mangler.cpp @@ -56,13 +56,16 @@ std::string Mangler::getValueName(const Value *V) { std::string name; if (V->hasName()) { // Print out the label if it exists... // Name mangling occurs as follows: + // - If V is an intrinsic function, do not change name at all // - If V is not a global, mangling always occurs. // - Otherwise, mangling occurs when any of the following are true: // 1) V has internal linkage // 2) V's name would collide if it is not mangled. // const GlobalValue* gv = dyn_cast(V); - if (gv && !gv->hasInternalLinkage() && !MangledGlobals.count(gv)) { + if (gv && isa(gv) && cast(gv)->getIntrinsicID()) { + name = gv->getName(); // Is an intrinsic function + } else if (gv && !gv->hasInternalLinkage() && !MangledGlobals.count(gv)) { name = makeNameProper(gv->getName()); if (AddUnderscorePrefix) name = "_" + name; } else { -- 2.34.1