Index: include/llvm/Transforms/IPO.h =================================================================== --- include/llvm/Transforms/IPO.h +++ include/llvm/Transforms/IPO.h @@ -31,6 +31,10 @@ class GlobalValue; class raw_ostream; +/// This function strips symbols from functions and modules. If PreserveDbgInfo +/// is true, debugging information is not removed. +bool StripSymbolNames(Module &M, bool PreserveDbgInfo); + //===----------------------------------------------------------------------===// // // These functions removes symbols from functions and modules. If OnlyDebugInfo Index: lib/Transforms/IPO/StripSymbols.cpp =================================================================== --- lib/Transforms/IPO/StripSymbols.cpp +++ lib/Transforms/IPO/StripSymbols.cpp @@ -201,8 +201,7 @@ UsedValues.insert(GV); } -/// StripSymbolNames - Strip symbol names. -static bool StripSymbolNames(Module &M, bool PreserveDbgInfo) { +bool llvm::StripSymbolNames(Module &M, bool PreserveDbgInfo) { SmallPtrSet llvmUsedValues; findUsedValues(M.getGlobalVariable("llvm.used"), llvmUsedValues); Index: test/BugPoint/strip-names-and-types.ll =================================================================== --- /dev/null +++ test/BugPoint/strip-names-and-types.ll @@ -0,0 +1,22 @@ +; REQUIRES: loadable_module +; RUN: bugpoint %s -output-prefix %t -silence-passes -safe-run-llc +; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s +; RUN: bugpoint %s -output-prefix %t -disable-strip-symbols -silence-passes -safe-run-llc +; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck --check-prefix=DISABLE %s + +%type0 = type { i32, i64 } + +define i1 @foo(i1 %A) { + ret i1 %A +} + +; CHECK-LABEL: define i32 @test +define i32 @test() { + %A = icmp eq %type0* undef, undef +; CHECK: icmp eq %0* undef, undef +; DISABLE: icmp eq %type0* undef, undef + call i1 @foo(i1 %A) +; CHECK: %2 = call i1 @foo(i1 %1) +; DISABLE: call i1 @foo(i1 %A) + ret i32 0 +} Index: tools/bugpoint/CrashDebugger.cpp =================================================================== --- tools/bugpoint/CrashDebugger.cpp +++ tools/bugpoint/CrashDebugger.cpp @@ -29,6 +29,7 @@ #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" @@ -61,6 +62,9 @@ cl::opt NoStripDebugTypeInfo("disable-strip-debug-types", cl::desc("Do not strip debug type info metadata"), cl::init(false)); +cl::opt NoStripSymbols("disable-strip-symbols", + cl::desc("Do not strip symbol and type names"), + cl::init(false)); cl::opt VerboseErrors("verbose-errors", cl::desc("Print the output of crashing program"), cl::init(false)); @@ -1127,6 +1131,10 @@ outs() << "\n*** Attempting to strip the debug type info: "; stripMetadata(stripNonLineTableDebugInfo); } + if (!NoStripSymbols && !BugpointIsInterrupted) { + outs() << "\n*** Attempting to strip symbol and type names: "; + StripSymbolNames(BD.getProgram(), true); + } if (!NoNamedMDRM) { if (!BugpointIsInterrupted) {