[llvm-branch-commits] [llvm-branch] r82296 - in /llvm/branches/Apple/Bender-SWB: include/llvm/Transforms/Utils/Local.h lib/Transforms/IPO/ConstantMerge.cpp lib/Transforms/IPO/GlobalDCE.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/Utils/Local.cpp
Devang Patel
dpatel at apple.com
Fri Sep 18 15:26:44 PDT 2009
Author: dpatel
Date: Fri Sep 18 17:26:44 2009
New Revision: 82296
URL: http://llvm.org/viewvc/llvm-project?rev=82296&view=rev
Log:
Back out r82239 for now.
Modified:
llvm/branches/Apple/Bender-SWB/include/llvm/Transforms/Utils/Local.h
llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/ConstantMerge.cpp
llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalDCE.cpp
llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalOpt.cpp
llvm/branches/Apple/Bender-SWB/lib/Transforms/Utils/Local.cpp
Modified: llvm/branches/Apple/Bender-SWB/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender-SWB/include/llvm/Transforms/Utils/Local.h?rev=82296&r1=82295&r2=82296&view=diff
==============================================================================
--- llvm/branches/Apple/Bender-SWB/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/branches/Apple/Bender-SWB/include/llvm/Transforms/Utils/Local.h Fri Sep 18 17:26:44 2009
@@ -22,7 +22,6 @@
class Instruction;
class Value;
class Pass;
-class GlobalVariable;
class PHINode;
class AllocaInst;
class ConstantExpr;
@@ -110,10 +109,6 @@
/// RemoveDbgInfoUser - Remove an User which is representing debug info.
void RemoveDbgInfoUser(User *U);
-/// IsGlobalVariableDebugInfo - Return true if GV is encoding debug info
-/// for a global variable.
-bool IsGlobalVariableDebugInfo(GlobalVariable *GV);
-
} // End llvm namespace
#endif
Modified: llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/ConstantMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/ConstantMerge.cpp?rev=82296&r1=82295&r2=82296&view=diff
==============================================================================
--- llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/ConstantMerge.cpp (original)
+++ llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/ConstantMerge.cpp Fri Sep 18 17:26:44 2009
@@ -21,7 +21,6 @@
#include "llvm/Transforms/IPO.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
-#include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
#include <map>
@@ -71,11 +70,9 @@
GVI != E; ) {
GlobalVariable *GV = GVI++;
- // If this GV is dead, remove it. Skip llvm.dbg.global_variable.
- if (!IsGlobalVariableDebugInfo(GV))
- GV->removeDeadConstantUsers();
- if (!IsGlobalVariableDebugInfo(GV) && GV->use_empty()
- && GV->hasLocalLinkage()) {
+ // If this GV is dead, remove it.
+ GV->removeDeadConstantUsers();
+ if (GV->use_empty() && GV->hasLocalLinkage()) {
GV->eraseFromParent();
continue;
}
Modified: llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalDCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalDCE.cpp?rev=82296&r1=82295&r2=82296&view=diff
==============================================================================
--- llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalDCE.cpp (original)
+++ llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalDCE.cpp Fri Sep 18 17:26:44 2009
@@ -20,7 +20,6 @@
#include "llvm/Constants.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
-#include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
#include <set>
@@ -72,10 +71,6 @@
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
Changed |= RemoveUnusedGlobalValue(*I);
- // Do not remove llvm.dbg.global_variable.
- if (GlobalVariable *GV = dyn_cast<GlobalVariable>(I))
- if (IsGlobalVariableDebugInfo(GV))
- GlobalIsNeeded(I);
// Externally visible & appending globals are needed, if they have an
// initializer.
if (!I->hasLocalLinkage() && !I->hasLinkOnceLinkage() &&
Modified: llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalOpt.cpp?rev=82296&r1=82295&r2=82296&view=diff
==============================================================================
--- llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/Apple/Bender-SWB/lib/Transforms/IPO/GlobalOpt.cpp Fri Sep 18 17:26:44 2009
@@ -22,7 +22,6 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
-#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/CallSite.h"
@@ -144,22 +143,11 @@
static bool ConstantIsDead(Constant *C) {
if (isa<GlobalValue>(C)) return false;
- for (Value::use_iterator UI = C->use_begin(), E = C->use_end(); UI != E; ) {
- // Remove llvm.dbg.global_variable.
- if (GlobalVariable *UGV = dyn_cast<GlobalVariable>(*UI)) {
- if (IsGlobalVariableDebugInfo(UGV)) {
- ++UI;
- if (UGV->use_empty())
- UGV->eraseFromParent();
- continue;
- }
- }
+ for (Value::use_iterator UI = C->use_begin(), E = C->use_end(); UI != E; ++UI)
if (Constant *CU = dyn_cast<Constant>(*UI)) {
if (!ConstantIsDead(CU)) return false;
} else
return false;
- ++UI;
- }
return true;
}
@@ -1550,21 +1538,13 @@
if (GVElType == Type::Int1Ty || GVElType->isFloatingPoint() ||
isa<PointerType>(GVElType) || isa<VectorType>(GVElType))
return false;
-
+
// Walk the use list of the global seeing if all the uses are load or store.
// If there is anything else, bail out.
- for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ) {
- if (Constant *CC = dyn_cast<Constant>(*I))
- if (ConstantIsDead(CC)) {
- ++I;
- CC->destroyConstant();
- continue;
- }
+ for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ++I)
if (!isa<LoadInst>(I) && !isa<StoreInst>(I))
return false;
- ++I;
- }
-
+
DOUT << " *** SHRINKING TO BOOL: " << *GV;
// Create the new global, initializing it to false.
Modified: llvm/branches/Apple/Bender-SWB/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Bender-SWB/lib/Transforms/Utils/Local.cpp?rev=82296&r1=82295&r2=82296&view=diff
==============================================================================
--- llvm/branches/Apple/Bender-SWB/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/branches/Apple/Bender-SWB/lib/Transforms/Utils/Local.cpp Fri Sep 18 17:26:44 2009
@@ -317,10 +317,3 @@
}
CE->destroyConstant();
}
-
-/// IsGlobalVariableDebugInfo - Return true if GV is encoding debug info
-/// for a global variable.
-bool llvm::IsGlobalVariableDebugInfo(GlobalVariable *GV) {
- return GV->hasName() &&
- strncmp(GV->getNameStart(), "llvm.dbg.global_variable", 24) == 0;
-}
More information about the llvm-branch-commits
mailing list