[llvm-commits] [llvm] r173265 - /llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp
Anton Korobeynikov
asl at math.spbu.ru
Wed Jan 23 07:03:08 PST 2013
Author: asl
Date: Wed Jan 23 09:03:08 2013
New Revision: 173265
URL: http://llvm.org/viewvc/llvm-project?rev=173265&view=rev
Log:
Make sure metarenamer won't rename special stuff (intrinsics and explicitly renamed stuff).
Otherwise this might hide the problems.
Modified:
llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp
Modified: llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp?rev=173265&r1=173264&r2=173265&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp Wed Jan 23 09:03:08 2013
@@ -72,13 +72,23 @@
// 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 @@
// 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);
}
More information about the llvm-commits
mailing list