[llvm-commits] [llvm] r59208 - /llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Devang Patel
dpatel at apple.com
Mon Nov 17 16:45:43 PST 2008
On Nov 15, 2008, at 10:36 PM, Chris Lattner wrote:
> On Nov 12, 2008, at 5:28 PM, Devang Patel wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=59208&view=rev
>> Log:
>> Really remove all debug information.
>
> Ok.
>
>> @@ -213,8 +220,30 @@
>> Declare->eraseFromParent();
>> }
>>
>> + // Delete all dbg variables.
>> + const Type *DbgVTy = M.getTypeByName("llvm.dbg.variable.type");
>> + const Type *DbgGVTy =
>> M.getTypeByName("llvm.dbg.global_variable.type");
>
> This isn't safe. You can depend on the names of non-internal globals,
> but not on the names of types. Type names can be stripped out.
This is true for values also. We can remove debug info. if names are
stripped out.
> Also,
> we may add new type names for debug info in the future.
>
>> + if (DbgVTy || DbgGVTy)
>> + for (Module::global_iterator I = M.global_begin(), E =
>> M.global_end();
>> + I != E; ++I)
>> + if (GlobalVariable *GV = dyn_cast<GlobalVariable>(I))
>> + if (GV->hasName() && GV->use_empty()
>> + && !strncmp(GV->getNameStart(), "llvm.dbg", 8)
>> + && (GV->getType()->getElementType() == DbgVTy
>> + || GV->getType()->getElementType() == DbgGVTy))
>> + DeadGlobals.push_back(GV);
>> +
>
> I don't think that matching on the names is really a sound way to go.
> How about just looping over all the globals, removing dead globals in
> the llvm.metadata section?
If it start remove dead globals then it becomes difficult to compare "-
strip-debug -std-compile-opts" output with "-std-compile-opts -strip-
debug" output.
-
Devang
More information about the llvm-commits
mailing list