aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2013-01-23 15:03:08 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2013-01-23 15:03:08 +0000
commit03f7e727f41bc6e7ed4fd4423ae0c8bb04412219 (patch)
tree5a3fd0d0b6eeef4a5252d5e6902281e2a9ac218a /lib/Transforms
parent48a615fee78c3c262c60147a65dc6fff5fd6bb3b (diff)
downloadexternal_llvm-03f7e727f41bc6e7ed4fd4423ae0c8bb04412219.zip
external_llvm-03f7e727f41bc6e7ed4fd4423ae0c8bb04412219.tar.gz
external_llvm-03f7e727f41bc6e7ed4fd4423ae0c8bb04412219.tar.bz2
Make sure metarenamer won't rename special stuff (intrinsics and explicitly renamed stuff).
Otherwise this might hide the problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/MetaRenamer.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/MetaRenamer.cpp b/lib/Transforms/Utils/MetaRenamer.cpp
index d519fb7..3716f58 100644
--- a/lib/Transforms/Utils/MetaRenamer.cpp
+++ b/lib/Transforms/Utils/MetaRenamer.cpp
@@ -72,13 +72,23 @@ namespace {
// Rename all aliases
for (Module::alias_iterator AI = M.alias_begin(), AE = M.alias_end();
- AI != AE; ++AI)
- AI->setName("alias");
+ AI != AE; ++AI) {
+ StringRef Name = AI->getName();
+ if (Name.startswith("llvm.") || (!Name.empty() && Name[0] == 1))
+ continue;
+ AI->setName("alias");
+ }
+
// Rename all global variables
for (Module::global_iterator GI = M.global_begin(), GE = M.global_end();
- GI != GE; ++GI)
+ GI != GE; ++GI) {
+ StringRef Name = GI->getName();
+ if (Name.startswith("llvm.") || (!Name.empty() && Name[0] == 1))
+ continue;
+
GI->setName("global");
+ }
// Rename all struct types
TypeFinder StructTypes;
@@ -95,6 +105,10 @@ namespace {
// Rename all functions
for (Module::iterator FI = M.begin(), FE = M.end();
FI != FE; ++FI) {
+ StringRef Name = FI->getName();
+ if (Name.startswith("llvm.") || (!Name.empty() && Name[0] == 1))
+ continue;
+
FI->setName(metaNames[prng.rand() % array_lengthof(metaNames)]);
runOnFunction(*FI);
}