Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Show First 20 Lines • Show All 2,706 Lines • ▼ Show 20 Lines | if (EvalSuccess) { | ||||
for (GlobalVariable *GV : Eval.getInvariants()) | for (GlobalVariable *GV : Eval.getInvariants()) | ||||
GV->setConstant(true); | GV->setConstant(true); | ||||
} | } | ||||
return EvalSuccess; | return EvalSuccess; | ||||
} | } | ||||
static int compareNames(Constant *const *A, Constant *const *B) { | static int compareNames(Constant *const *A, Constant *const *B) { | ||||
return (*A)->getName().compare((*B)->getName()); | return (*A)->stripPointerCasts()->getName().compare( | ||||
(*B)->stripPointerCasts()->getName()); | |||||
} | } | ||||
static void setUsedInitializer(GlobalVariable &V, | static void setUsedInitializer(GlobalVariable &V, | ||||
const SmallPtrSet<GlobalValue *, 8> &Init) { | const SmallPtrSet<GlobalValue *, 8> &Init) { | ||||
if (Init.empty()) { | if (Init.empty()) { | ||||
V.eraseFromParent(); | V.eraseFromParent(); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines |