[llvm] r234792 - StripSymbols: Use DIGlobalVariable::getConstant() instead of getGlobal()

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 13 13:13:30 PDT 2015


Author: dexonsmith
Date: Mon Apr 13 15:13:30 2015
New Revision: 234792

URL: http://llvm.org/viewvc/llvm-project?rev=234792&view=rev
Log:
StripSymbols: Use DIGlobalVariable::getConstant() instead of getGlobal()

The only difference between the two is a `dyn_cast<>` to
`GlobalVariable`.  If optimizations have left anything behind when a
global gets replaced, then it doesn't seem like the debug info is dead.

I can't seem to find an optimization that would leave behind a
non-`GlobalVariable` without nulling the reference entirely, so I
haven't added a testcase (but I'll be deleting `getGlobal()` in a future
commit).

Modified:
    llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp

Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=234792&r1=234791&r2=234792&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Mon Apr 13 15:13:30 2015
@@ -335,7 +335,7 @@ bool StripDeadDebugInfo::runOnModule(Mod
 
       // If the global variable referenced by DIG is not null, the global
       // variable is live.
-      if (DIG.getGlobal())
+      if (DIG.getConstant())
         LiveGlobalVariables.push_back(DIG);
       else
         GlobalVariableChange = true;





More information about the llvm-commits mailing list