SymbolRewriter: prevent unnecessary rewrite
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 27 Jan 2015 22:57:35 +0000 (22:57 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 27 Jan 2015 22:57:35 +0000 (22:57 +0000)
The rewrite for the pattern based rewrite is unnecessary if the existing name
matches the pattern.

llvm-svn: 227260

llvm/lib/Transforms/Utils/SymbolRewriter.cpp

index b35a662..c93cdc4 100644 (file)
@@ -145,6 +145,9 @@ performOnModule(Module &M) {
       report_fatal_error("unable to transforn " + C.getName() + " in " +
                          M.getModuleIdentifier() + ": " + Error);
 
+    if (C.getName() == Name)
+      continue;
+
     if (Value *V = (M.*Get)(Name))
       C.setValueName(V->getValueName());
     else